Page 1 of 1

CheckAUService fixed wuauserv not running

PostPosted: 10.11.2011, 14:21
by 1inux
Sometimes doupdate.cmd stop with the error that wuauserv is not running.

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

Re: CheckAUService fixed wuauserv not running

PostPosted: 23.11.2011, 11:53
by WSUSUpdateAdmin
Hi Jan,

thanks for your suggestion!
I prefer a slightly different solution in http://trac.wsusoffline.net/browser/trunk (r315): "- Fix: When running under WOUTempAdmin user account, DoUpdate.cmd script will now assume that the service 'automatic updates' (wuauserv) is running if its start mode is 'Auto' (Thanks to "1inux")".

Regards
Torsten