Code:
 
;************************************ W2K HotFix Updates *****************************************
if @ras=0
$arrkey = arrEnumKey('HKLM\SOFTWARE\Microsoft\Updates\Windows 2000\SP5')
$arrdir = arrEnumDir($setup+'\Win2k_Hotfixes','*.exe',1)
$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 CRTICAL 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'
$ = Writeprofilestring($logon+'\inventory\HotFix.log', $parsed, @wksta, @date)
$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 WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If Not VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
While Not $oExec.Status Loop
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If Not $NoEcho $Output Endif
$WshPipe=Split($Output,CHR(10))
Exit($oExec.ExitCode)
EndFunction
;****************************************************************************************************
Function arrEnumdir($directory, optional $mask, Optional $Subdir)
if $subdir $subdir='/s' endif
if exist($directory)
$E = WshPipe('%comspec% /c dir "$directory\$mask" /b $subdir',1)
redim preserve $e[ubound($e)-1]
$arrEnumdir=split(join($e,'|'),chr(13)+'|')
else
exit 87
endif
Endfunction
;****************************************************************************************************



_________________________
How to ask questions the smart way <-----------> Before you ask