Windows Update – script it

So you need to fiddle a bit with Windows Update, the reasons can be many;

  1. you want to centrally initiate an update
  2. you are paranoid and want to script a daily/weekly or monthly Windows Update (in case the automatic detection fail).

Well, for help on how to launch it on different remote machines I suggest you visit Dave’s Blog;
http://skatterbrainz.blogspot.com/2009/01/script-code-batch-running-wuauclt.html

A Desktop shortcut;
You could also simply create a desktop shortcut linking to

wuauclt.exe /resetauthorization /detectnow

This would force a Windows Updates detection to run upon clicking the shortcut, somewhat easier than launching the website.

The script you would need locally could look something like this;

@Echo off
Echo Stopping Windows Update Service
net stop wuauserv
Echo Starting Windows Update Service
net start wuauserv
Echo Forcing Windows Update detection
%windir%system32wuauclt.exe /detectnow

I also stumbled across some neat commands to try in case you are debugging Windows Update (update not working);
http://www.techsupportforum.com/microsoft-support/windows-xp-support/279270-automatic-update-not-started-error-1058-a.html

net stop wuauserv 
del /f /s /q %windir%SoftwareDistribution*.*
net start wuauserv 
wuauclt.exe /detectnow
_____________________

net stop bits 
net stop wuauserv 
%windir%system32
egsvr32.exe /s %windir%system32atl.dll 
%windir%system32
egsvr32.exe /s %windir%system32jscript.dll 
%windir%system32
egsvr32.exe /s %windir%system32msxml3.dll 
%windir%system32
egsvr32.exe /s %windir%system32softpub.dll 
%windir%system32
egsvr32.exe /s %windir%system32wuapi.dll 
%windir%system32
egsvr32.exe /s %windir%system32wuaueng.dll 
%windir%system32
egsvr32.exe /s %windir%system32wuaueng1.dll 
%windir%system32
egsvr32.exe /s %windir%system32wucltui.dll 
%windir%system32
egsvr32.exe /s %windir%system32wups.dll 
%windir%system32
egsvr32.exe /s %windir%system32wuweb.dll 
net start bits 
net start wuauserv 
wuauclt /resetauthorization /detectnow
_____________________________

net stop bits 
net stop wuauserv 
regsvr32 /u wuaueng.dll /s
del /f /s /q %windir%SoftwareDistribution*.*
del /f /s /q %windir%windowsupdate.log
regsvr32 wuaueng.dll /s
net start bits
net start wuauserv
wuauclt.exe /resetauthorization /detectnow

PPS. Vista/Win2008 users beware.
Stopping services etc under windows vista/2008/7  require the scripts to be run as an administrator.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *