Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for wutest.bat

(view source code of wutest.bat as plain text)

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

page last modified: 2024-04-16; loaded in 0.0163 seconds