Last modified 4 years ago Last modified on 18/06/10 10:52:55
[WuInstall] can install all updates for a computer from a WSUS or Windows Update.
Please download the program from the website http://www.wuinstall.com and unpack it to "packages/wuinstall/"
This script REQUIRES the attached patch to todo.pl, to implement two new pseudo commands .rerun and .reboot-rerun!
The program [WuInstall] http://www.wuinstall.com can fully update a windows computer from a WSUS or Windows Update, but to do this it often needs to be started multiple times, sometimes with a reboot in between.
The two commented out actions may be required in some environments, and so I left them in to maybe spare someone the work of searching and implementing these. The "wuauclt /reportnow" is for convenience for WSUS users only, and can be commented out or removed. This updates the state of the computer in WSUS immediately, which can take quite some time otherwise.
Note aside: You can actually modify the wuinstall.bat script to not use the new commands, but that would require many calls to wuinstall.bat in a row in your install script to rerun it enough times. This would neither be nice to look at, nor will it guarantee to fully upgrade a computer.
:: OPTIONAL: Updates via WUInstall :: http://wuinstall.com/ :: Download the free version and extract it to packages/wuinstall/ :: This script should work with the Pro version too :: Report to WSUS Server now, to update the status of this computer faster in WSUS, this is for convenience only todo.pl "wuauclt /reportnow" :: Update until no more updates are found, try again if necessary, reboot first if required todo.pl ".rerun-on 1 .ignore-err 2 .reboot-rerun-on 10 .reboot-rerun-on 11 .reboot-rerun-on 12 %Z%\packages\wuinstall\wuinstall.exe /install /criteria \"IsInstalled=0 and DeploymentAction='Installation' and IsAssigned=1\"" :: You may need the following entries: :: Clear proxy settings in IE and system :: todo.pl "proxycfg -d" :: todo.pl "reg add \"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" /f /v \"ProxyEnable\" /t REG_DWORD /d 0" :: Update Group Policy and reboot :: todo.pl ".expect-reboot gpupdate /force /boot"
Index: todo.pl =================================================================== --- todo.pl (Revision 3214) +++ todo.pl (Arbeitskopie) @@ -24,6 +24,7 @@ # Location of the "to do" logs. my $log = "$c\\netinst\\logs\\todo.txt"; +my $fullcmd; # Determine alternate letter for z: drive and store it in Z # environment variable (unless it is already set). unless (exists $ENV{'Z'}) { @@ -381,7 +382,32 @@ } $ret = $status; + } + elsif ($cmd =~ /^\.rerun-on\s+(\d+)\s+(.*)$/) { + my ($err_to_rerun, $new_cmd) = ($1, $2); + my $status = do_cmd ($new_cmd, 1); + + if ($status == $err_to_rerun << 8) { + print "$new_cmd exited status $err_to_rerun; rerunning.\n"; + push_todo($fullcmd); + $status = 0; + } + + $ret = $status; } + elsif ($cmd =~ /^\.reboot-rerun-on\s+(\d+)\s+(.*)$/) { + my ($err_to_reboot, $new_cmd) = ($1, $2); + my $status = do_cmd ($new_cmd, 1); + + if ($status == $err_to_reboot << 8) { + print "$new_cmd exited status $err_to_reboot; rebooting and rerunning.\n"; + push_todo($fullcmd); + do_cmd ('.reboot'); + die 'Internal error'; + } + + $ret = $status; + } elsif ($cmd =~ /^\.missing-ok\s+(.*)$/) { my $new_cmd = $1; my $status = do_cmd ($new_cmd, 1); @@ -505,8 +531,8 @@ # Disable running ourselves after reboot. run_at_logon (); - while (defined (my $cmd = pop_todo ())) { - do_cmd ($cmd); + while (defined ($fullcmd = pop_todo ())) { + do_cmd ($fullcmd); } } else {