JATO
23rd January 2007 10:16 UTC
Windows Updater
Has anyone come up with a script that run Microsoft Updates from a Network drive?
I searched the forums but didn't fine one.
I'm thinking of creating one, but thought I'd check if someone wouldn't mind sharing their source code.
My idea is that the script would install ALL the updates in a particular network folder that weren't already installed on the OS. This way, it could be run as often as you want and only install what is necessary.
I'm having a hard time figuring out how to get NSIS to compare which Updates are already installed with the updates in the network path. - ANy ideas?
I'm thinking NSIS would need to compare the EXEs on the network to C:\WINDOWS\$NtUninstallKB###### and then execute the appropriate WindowsXP-KB######-x86-ENU.exe file.
Any ideas?
So If no one has a script that does this already, then I'm not sure the best way to get NSIS to look at the network folder and only install the updates it needs.
Red Wine
23rd January 2007 18:44 UTC
Something like this I guess,
;REQUIRES MOREINFO PLUGIN http://nsis.sourceforge.net/MoreInfo_plug-in
!define UPDATES_DIR "C:\Critical Updates" ;add here the real path to updates folder
!define KB_CHECK "$$NtUninstallKB$kbnum$$"
Name "Windows Critical Updates Installer"
Caption "$(^name)"
OutFile 'updater.exe'
LicenseData '${NSISDIR}\License.txt'
LicenseBkColor 0xFFFFFF
ShowInstDetails show
var kbnum
page license
page instfiles
Section "All in one"
FindFirst $0 $1 "${UPDATES_DIR}\*.exe"
loop:
IfErrors done
detailprint 'Found Update: $1'
MoreInfo::GetUserDefined "${UPDATES_DIR}\$1" "KB Article Number"
Pop $kbnum
detailprint 'KB Article Number is: $kbnum'
detailprint "............"
detailprint "Looking for: $WINDIR\${KB_CHECK}"
IfFileExists "$WINDIR\${KB_CHECK}\*" 0 install
detailprint 'Critical Update KB$kbnum is installed'
Goto next
install:
detailprint 'Critical Update KB$kbnum is NOT installed'
detailprint 'Updating system with KB$kbnum. Please wait...'
;replace /help with required switches advisable are /quiet /norestart
ExecWait "${UPDATES_DIR}\$1 /help" $3 ;/quiet /norestart
Detailprint "Return value: $3" ;use return value to verify successful update
SetRebootFlag true
detailprint '...........'
next:
FindNext $0 $1
Goto loop
done:
FindClose $0
IfRebootFlag 0 +3
messagebox mb_yesno|mb_iconexclamation "Reboot required, reboot now?" idno +2
Reboot
SectionEnd