@ECHO OFF :: Quick and dirty test for Windows Update. :: No guarantee, as I couldn't test failed Windows Updates. :: Checks if the last WU install was later than the last WU download, if not it will report a failure. :: Written by Rob van der Woude : http://www.robvanderwoude.com SETLOCAL SET RegKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results FOR /F "skip=4 tokens=2*" %%A IN ('REG Query "%RegKey%\Download" /V "LastSuccessTime"') DO SET LastDownload=%%B FOR /F "skip=4 tokens=2*" %%A IN ('REG Query "%RegKey%\Install" /V "LastSuccessTime"') DO SET LastInstall=%%B IF "%LastInstall%" LSS "%LastDownload%" ( ECHO Last Windows Update failed ^(%LastDownload%^) ) ELSE ( ECHO Last Windows Update succeeded ^(%LastInstall%^) ) ENDLOCAL