just to refresh the post for the new patches that just came out...
Code:
;************************************ W2K HotFix Updates *****************************************
$arrkey = arrEnumKey('HKLM\SOFTWARE\Microsoft\Updates\Windows 2000\SP5')
$arrdir = FileList($setup+'\Win2k_Hotfixes','.exe',1)
if not @error
$reboot = 0
for each $dir in $arrdir
$installed = 0
$parsed = split($dir,'-')[1]
for each $key in $arrkey
if $key = $parsed $installed = 1 endif
next
if not $installed
$=sendmessage(@wksta,"A CRITICAL upgrade is now starting. Your computer will restart on it's own in about 2-3 minutes. Please do not open any programs. There is no need to click the OK button.")
? ' Installing '+$parsed
shell '%comspec% /c ' + $dir + ' -q -z -u -n -o'
$reboot = 1
endif
next
if $reboot
ShutDown ('', 'Updates have been applied that require to computer to restart', 5, 1, 1)
quit
endif
endif
;****************************************************************************************************
function arrenumkey($regkey)
dim $Keylist, $c
if not keyexist($regkey) exit 87 endif
do
$Key = $Key+'|'+enumkey($regkey,$c)
$c = $c + 1
until @error
$arrenumkey = split(substr($Key,2,len($Key)-2),'|')
Endfunction
;****************************************************************************************************
Function FileList($folderName,optional $mask, optional $path)
Dim $objDir, $fullpath, $t, $objfile
$objDir = CreateObject("Scripting.FileSystemObject")
if not @error ; usually folder not found
$files=$objDir.GetFolder($folderName).Files
$Fullpath=iif($path,$foldername+'\','')
For Each $objFile In $files
$name=$objFile.name
if ($mask and instr($name,$mask)) or not $mask
$t=$t+'|'+$Fullpath+$name
endif
Next
$FileList=split(substr($t,2),'|')
else
; ?color r+/n 'FSO Create Object error: ' @serror color w/n
endif
exit iif(len($t)>1,0,1)
EndFunction