patch.kix: using srvany.exe to run as a service on the client PC
Code:
break on
$ini='@scriptdir\patch.ini'
$setupfolder = 'S:\Win2k_Hotfixes'
for each $section in inisections($ini)
$install = 0
$patch = readprofilestring($ini,$section,'patch')
if exist($setupfolder+'\'+$patch)
if readprofilestring($ini,$section,'check') = 'key'
$key = readprofilestring($ini,$section,'regkey')
if not @error and not keyexist($key) $install = 1 endif
else
$updated = ExpandEnvironmentVars(readprofilestring($ini,$section,'updated'))
$version = readprofilestring($ini,$section,'version')
if not exist($updated) $install = 1 endif
if getfileversion($updated) < $version $install = 1 endif
endif
if $install
? $patch + ' needs to be installed'
$command = ExpandEnvironmentVars(readprofilestring($ini,$section,'command'))
; copy $setupfolder+'\'+$patch c:\
; shell '%comspec% /c c:\'+$command
; runonce...
? '%comspec% /c c:\' + $command
else
? $patch +' is already installed'
endif
endif
next
? 'done'
function IniSections($file)
dim $sections
if not exist($file) exit 1 endif
$sections = join(split(readprofilestring($file,'',''),chr(10)),'|')
$IniSections = split(left($sections,len($sections)-1),'|')
endfunction
and here is the ini file on the server
Code:
[KB329115]
patch = Windows2000-KB329115-x86-ENU.exe
check = key
regkey = HKLM\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB329115
command = Windows2000-KB329115-x86-ENU.exe -q -z -u -n -o
[KB823182]
patch = Windows2000-KB823182-x86-ENU.exe
check = file
updated = %windir%\system32\cryptui.dll
version = 5.131.2195.6758
command = Windows2000-KB823182-x86-ENU.exe -q -z -u -n -o
[Internet Explorer 6 Security Rollup - November 2003]
patch = q824145.exe
check = key
regkey = HKLM\Software\Microsoft\Active Setup\Installed Components\{057997dd-71e4-43cc-b161-3f8180691a9e}
command = q824145.exe /q /r:n