le tasks will be 
REM triggered to run maintenance. The script will wait until this
REM is complete.
REM
REM Any third party script that needs to run before the state
REM change should run in the UPDATE_SUCCESS block
REM
REM Environment :
REM It is expected that UWF is turned "OFF", "SERVICING" mode 
REM enabled and all other preconditions
REM for servicing are in place. 
REM
REM
REM 


echo UpdateAgent starting.
uwfmgr servicing update-windows
if ERRORLEVEL 3010 goto UPDATE_REBOOT
if ERRORLEVEL 0 goto UPDATE_SUCCESS
echo UpdateAgent returned error =%ERRORLEVEL%
 
:UPDATE_ERROR
uwfmgr servicing disable
echo Restarting system
goto UPDATE_EXIT

:UPDATE_REBOOT
echo UpdateAgent requires a reboot.
echo UpdateAgent restarting system
goto UPDATE_EXIT

:UPDATE_SUCCESS
echo UpdateAgent returned success.

REM
REM Trigger idle maintenance tasks, and wait for completion.
REM Note that ProcessIdleTasksW will do nothing if automatic
REM maintenance is disabled.
REM

echo UpdateAgent executing maintenance tasks.
start /wait rundll32.exe advapi32.dll,ProcessIdleTasksW
echo UpdateAgent maintenance tasks completed.

REM
REM echo UpdateAgent executing OEM script
REM OEM can call their custom scripts
REM at this point thru a "call".
REM
REM The OEM script should hand control
REM back to this script once its done.
REM
REM Any error recovery for OEM script
REM should be handled outside of this script
REM post a reboot.
REM
REM *******************************************************
REM OEM scripts go below this line.
REM 



REM
REM OEM scripts go above this line.
REM *******************************************************
REM

uwfmgr servicing disable
echo Restarting system
goto UPDATE_EXIT

:UPDATE_EXIT
echo UpdateAgent exiting.
shutdown -r -t 5
EXIT /B