Friday, July 20, 2012

WUA force

Sometimes you want to install critical and security updates on a Windows machine using WSUS Server immediately.

Just restart the 'Automatic Update Service' you would think?

No way. You have to do a bit more...

This script forces the update detection from automatic update client (WUA) for updates on WSUS Server.

Copy and paste the code below into a text file and name it ForceUpdate.cmd:

@echo off

echo This script 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


@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.


Execute the ForceUpdate.cmd file and the magic happens.