RFC: disable WSUS and Windows 10 updates (my first package. Alpha!)

Antworten
TArnold
Beiträge: 5
Registriert: 08 Jun 2017, 12:36

RFC: disable WSUS and Windows 10 updates (my first package. Alpha!)

Beitrag von TArnold »

Hello,

I am new to OPSI packaging and build a really simple package and now I would like to get comments and suggestions on how to do it better or nicer. All the experts here will probably not like what I did, but it kind of works for me. The other solutions to this problem had issues.

It disables the WSUS key and runs Windows 10 Update, but it looks really ugly.

All I have right now is this setup.opsiscript:

Code: Alles auswählen

[Actions]
DosInAnIcon_batch


[DosInAnIcon_batch]
@echo off
setlocal

rem wsus-client-delete.cmd
rem
rem (c) 2009 c't & Lars Titze
rem

echo Auto-Update-Dienst anhalten
"%windir%\system32\net.exe" stop "wuauserv" || (
echo Bitte starten Sie das Skript mit Adminstartorrechten.
pause
exit /b 2
)

echo Registry-Datei erzeugen
(
echo Windows Registry Editor Version 5.00
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
) > "%temp%\wsus-client-delete.reg"

echo Registy anpassen
"%windir%\Regedit.exe" /s "%temp%\wsus-client-delete.reg"

if ""=="%debug%" (
	echo Registry-Datei entfernen
	erase "%temp%\wsus-client-delete.reg"
	)

echo Auto-Update-Dienst starten
"%windir%\system32\net.exe" start "wuauserv"

REM These two commands do not need a path
usoclient ScanInstallWait
usoclient StartInstall

REM Wait 40 mins to allow all the installs to complete
timeout /T 2400
ShutdownWithUpdates.exe /r /f
I would like to add a nice text and maybe a logo, a working progress bar would be nice ... but probably hard. Any hints?
Benutzeravatar
SisterOfMercy
Beiträge: 1523
Registriert: 22 Jun 2012, 19:18

Re: RFC: disable WSUS and Windows 10 updates (my first package. Alpha!)

Beitrag von SisterOfMercy »

TArnold hat geschrieben:I am new to OPSI packaging and build a really simple package and now I would like to get comments and suggestions on how to do it better or nicer. All the experts here will probably not like what I did, but it kind of works for me. The other solutions to this problem had issues.
No takers? Well, ok.
It looks like you took a batch script and put that in an opsi package, while ignoring the extra options the opsi script has.
TArnold hat geschrieben:It disables the WSUS key and runs Windows 10 Update, but it looks really ugly.

All I have right now is this setup.opsiscript:

Code: Alles auswählen

[Actions]
DosInAnIcon_batch


[DosInAnIcon_batch]
@echo off
setlocal

rem wsus-client-delete.cmd
rem
rem (c) 2009 c't & Lars Titze
rem

echo Auto-Update-Dienst anhalten
"%windir%\system32\net.exe" stop "wuauserv" || (
echo Bitte starten Sie das Skript mit Adminstartorrechten.
pause
exit /b 2
)

echo Registry-Datei erzeugen
(
echo Windows Registry Editor Version 5.00
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
) > "%temp%\wsus-client-delete.reg"

echo Registy anpassen
"%windir%\Regedit.exe" /s "%temp%\wsus-client-delete.reg"

if ""=="%debug%" (
	echo Registry-Datei entfernen
	erase "%temp%\wsus-client-delete.reg"
	)

echo Auto-Update-Dienst starten
"%windir%\system32\net.exe" start "wuauserv"

REM These two commands do not need a path
usoclient ScanInstallWait
usoclient StartInstall

REM Wait 40 mins to allow all the installs to complete
timeout /T 2400
ShutdownWithUpdates.exe /r /f
I would like to add a nice text and maybe a logo, a working progress bar would be nice ... but probably hard. Any hints?
Why would you want to disable the wsus stuff and get updates from windows update?
But anyway, let's keep your script the same, but change it so it looks more like an opsi script.

Code: Alles auswählen

[Actions]
DefVar $ProductId$
Set $ProductId$       = "asdf"

comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
; if your productid is asdf then create a asdf.png in the same directory as the opsiscript.

Winbatch_stop_service /Sysnative
Registry_install /Sysnative
Winbatch_start_service /Sysnative
Winbatch_start_update /Sysnative
sleepseconds 2400
Winbatch_shutdown /Sysnative

[Winbatch_stop_service]
"%SystemRoot%\system32\net.exe" stop "wuauserv"

[Winbatch_start_service]
"%SystemRoot%\system32\net.exe" start "wuauserv"

[Winbatch_start_update]
"%SystemRoot%\system32\UsoClient.exe" ScanInstallWait
"%SystemRoot%\system32\UsoClient.exe" StartInstall

[Registry_install]
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]

[Winbatch_shutdown]
"%ScriptPath%\ShutdownWithUpdates.exe" /r /f
; %ScriptPath% is the directory where your opsiscript resides.
Of course the timeout and reboot could be done much nicer, but I'm not sure if usoclient unloads itself if it is done downloading updates.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
TArnold
Beiträge: 5
Registriert: 08 Jun 2017, 12:36

Re: RFC: disable WSUS and Windows 10 updates (my first package. Alpha!)

Beitrag von TArnold »

Hey, thank you very much.

We have the WSUS key set so that the Windows clients are still under our control when to get updates, but we have no WSUS server.

I will integrate your changes and report back.

Thanks again.
TArnold
Beiträge: 5
Registriert: 08 Jun 2017, 12:36

Re: RFC: disable WSUS and Windows 10 updates (my first package. Alpha!)

Beitrag von TArnold »

Seems to be awesome, but still testing.

Thanks much.
Antworten