In DoUpdate.cmd a added the following lines:
- Code: Select all
if /i "%AU_SVC_STATE_INITIAL%"=="" goto ListMissingIds
if /i "%AU_SVC_STATE_INITIAL%"=="Unknown" goto ListMissingIds
if /i "%AU_SVC_STATE_INITIAL%"=="Running" goto ListMissingIds
if /i "%AU_SVC_START_MODE%"=="Disabled" goto AUSvcNotRunning
echo Starting service 'automatic updates' (wuauserv)...
%SystemRoot%\system32\net.exe start wuauserv >nul
rem: ----8<----fixing problem because allready startet----8<---
if errorlevel 1 (
echo Restarting service 'automatic updates' (wuauserv)...
%SystemRoot%\system32\net.exe stop wuauserv >nul
%SystemRoot%\system32\net.exe start wuauserv >nul
if errorlevel 1 (
echo %DATE% %TIME% - Error: Restarting service 'automatic updates' (wuauserv) failed, reboot now >>%UPDATE_LOGFILE%
%SystemRoot%\system32\shutdown -r -t 3
)
)
rem: ----8<----fixing problem because allready startet----8<---
rem: if errorlevel 1 goto AUSvcNotRunning
set AU_SVC_STARTED=1
echo %DATE% %TIME% - Info: Started service 'automatic updates' (wuauserv) >>%UPDATE_LOGFILE%
Cheers
Jan