Another great utility for WSUS administrator ... ForceUpdate.bat

I used this utility on the last tour to “kickstart” the WSUS client on my Exchange box to register and download updated with my WSUS server.  If you search the web, you will see a number of articles talking about kickstarting the auto update client – I like this one from my friend Rod at “the Lazy Admin” blog… He talks in the comments section on how to get the process to work with Windows 2000 based systems…

I found out about the process when I was asked to speak at the Ottawa IT Security Summit last spring. I was presenting on Microsoft Update technologies and I wanted to have a quick way on getting clients to check for approved updates.  I started with the source (support.microsoft.com) and did some searches to find this little gem created and posted under the Community Solutions section… It was documented and written up by Mohammed Athif Khaleel MVP on his blog in this article…  Here is the quick and dirty batch file.

====================================================
@echo off
Echo This batch file will Force the Update Detection from the AU client:
Echo 1. Stops the Automatic Updates Service (wuauserv)
Echo 2. Deletes the LastWaitTimeout registry key (if it exists)
Echo 3. Deletes the DetectionStartTime registry key (if it exists)
Echo 4. Deletes the NextDetectionTime registry key (if it exists)
Echo 5. Restart the Automatic Updates Service (wuauserv)
Echo 6. Force the detection
Pause
@echo on
net stop wuauserv
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v LastWaitTimeout /f
REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v DetectionStartTime /f
Reg Delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v NextDetectionTime /f
net start wuauserv
wuauclt /detectnow
@echo off
Echo This AU client will now check for the Updates on the Local WSUS Server.
Pause
====================================================

I’ve taken this code and then removed the on screen prompts and pause statements. You will get error messages about keys not existing – this is normal, since the keys may not exist.  Don’t Worry – the process works despite the on-screen error messages. 

I saved my updated file as ForceUpdate.cmd and then make it available to the systems that need it.  It can be run manually or even deployed using SMS as a package if you want.  Great work Mohammed!