I wrote this script to automatically update certain system files when the user logs on to the Network.You will have to alter some of the paths and the utility that you use to restart you machine but apart from that it should work fine.
Place this code in your calling script:
Call "Updates.kix"
If $Restart = "Yes"
Play file "c:\windows\dialog.spk"
Exit
Endif
What follows is the main update script.
<Code>
; Script to Update files if required
$Result = DelValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","ForcedLogoff")
$Restart = "No"
$LineBreak = Chr(10)
Del "%WinDir%\Wininit.ini"
$Marker = Instr(@Wksta, ")")
$Room = Substr(@Wksta,2,$Marker-2)
$Station = Substr(@Wksta,$Marker+8,10)
; Update Kix32 on Local machine if required
$KixVer = "362"
$File1 = GetFileVersion("$PDC\netlogon\Kixtart\$KixVer\kix32.exe")
$File2 = GetFileVersion("%WinDir%\kix32.exe")
If $File1 <> $File2
$Restart = "Yes"
$Result = WriteProfileString("%WinDir%\Wininit.ini","Rename","%WinDir%\Kix32.exe","C:\Kix32.exe")
$Result = WriteProfileString("%WinDir%\Wininit.ini","Rename","%WinDir%\Kx16.dll","C:\Kx16.dll")
$Result = WriteProfileString("%WinDir%\Wininit.ini","Rename","%WinDir%\Kx32.dll","C:\Kx32.dll")
$Result = WriteProfileString("%WinDir%\Wininit.ini","Rename","%WinDir%\Kx95.dll","C:\Kx95.dll")
Copy "$PDC\netlogon\Kixtart\$KixVer\kix32.exe" C:\kix32.exe /h
Copy "$PDC\netlogon\Kixtart\$KixVer\kx16.dll" C:\kx16.dll /h
Copy "$PDC\netlogon\Kixtart\$KixVer\kx32.dll" C:\kx32.dll /h
Copy "$PDC\netlogon\Kixtart\$KixVer\kx95.dll" C:\kx95.dll /h
Endif
; Update MSNet32.dll if required
$File1 = GetFileTime("$PDC\netlogon\updates\win98SE\msnet32.dll")
$File2 = GetFileTime("%WinDir%\system\msnet32.dll")
If $File1 <> $File2
$Restart = "Yes"
$Result = WriteProfileString("%WinDir%\Wininit.ini","Rename","%WinDir%\System\msnet32.dll","C:\msnet32.dll")
Copy "$PDC\netlogon\updates\win98SE\msnet32.dll" C:\msnet32.dll /h
Endif
; Update Shell32.dll if required
$File1 = GetFileTime("$PDC\netlogon\updates\win98SE\shell32.dll")
$File2 = GetFileTime("%WinDir%\system\shell32.dll")
If $File1 <> $File2
$Restart = "Yes"
$Result = WriteProfileString("%WinDir%\Wininit.ini","Rename","%WinDir%\System\shell32.dll","C:\shell32.dll")
Copy "$PDC\netlogon\updates\win98SE\shell32.dll" C:\shell32.dll /h
Endif
; Check for newer Hosts file and copy to Local Computer if found
$Result = CompareFileTimes("$PDC\netlogon\hosts","%WinDir%\hosts")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\hosts" "%WinDir%\hosts" /h
EndIf
; Check for newer WorkView file and copy to Local Computer if found
$Result = CompareFileTimes("$PDC\netlogon\each station\workview\workview.mdb","c:\program files\workview\workview.mdb")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\workview\workview.mdb" "c:\program files\workview\workview.mdb" /h
EndIf
; Copy LogOff.kix to Local Machine if newer
$Result = CompareFileTimes("$PDC\netlogon\each station\various\logoff.kix","%WinDir%\logoff.kix")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\various\logoff.kix" "%WinDir%\LogOff.kix" /h
EndIf
; Copy KiXtart.ini to Local Machine if newer
$Result = CompareFileTimes("$PDC\netlogon\each station\various\kixtart.ini","%WinDir%\kixtart.ini")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\various\kixtart.ini" "%WinDir%\KiXtart.ini" /h
EndIf
; Copy Shutdown.exe to Local Machine if newer
$Result = CompareFileTimes("$PDC\Netlogon\NetUtils\shutdown\shutdown.exe","%WinDir%\shutdown.exe")
If $Result = -3 or $Result = 1
Copy "$PDC\Netlogon\NetUtils\shutdown\shutdown.exe" "%WinDir%\shutdown.exe" /h
EndIf
; Copy 'You Have Mail.wav' to Local Machine
$Result = CompareFileTimes("$PDC\netlogon\each station\various\you have mail.wav","%WinDir%\you have mail.wav")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\various\You Have Mail.wav" "%WinDir%\You Have Mail.wav" /h
EndIf
; Copy 'Conagent.pif' to Local Machine
$Result = CompareFileTimes("$PDC\netlogon\each station\various\Conagent.pif","%WinDir%\System\Conagent.pif")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\various\Conagent.pif" "%WinDir%\System\Conagent.pif" /h
EndIf
; Copy 'LMScript.pif' to Local Machine
$Result = CompareFileTimes("$PDC\netlogon\each station\various\LMScript.pif","%WinDir%\System\LMScript.pif")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\various\LMScript.pif" "%WinDir%\System\LMScript.pif" /h
EndIf
; Copy 'MailSpy' to Local Machine
$Result = CompareFileTimes("$PDC\netlogon\each station\MailSpy\MailSpy.exe","%WinDir%\MailSpy.exe")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\MailSpy\*.*" "%WinDir%\" /h
EndIf
; Copy 'ClrName' to Local Machine
$Result = CompareFileTimes("$PDC\netlogon\each station\various\Clrname.exe","%WinDir%\Clrname.exe")
If $Result = 1 or $Result = -3
Copy "$PDC\netlogon\each station\various\clrname.exe" "%WinDir%\" /h
EndIf
; Copy Ctl3d.dll to Local Machine if not present
If Exist("C:\Windows\System\Ctl3d.dll") = 0
Copy "$PDC\netlogon\each station\various\ctl3d.dll" "%WinDir%\System\" /h
Endif
; Copy Kill.exe to Local Machine if not present
If Exist( "C:\Windows\Kill.exe" ) = 0
Copy "$PDC\netlogon\each station\various\kill.exe" "%WinDir%\" /h
Endif
; Copy XXCopy.exe to Local Machine if not present
If Exist( "C:\Windows\XXCopy.exe" ) = 0
Copy "$PDC\netlogon\each station\various\xxcopy.exe" "%WinDir%\" /h
Endif
; Copy SendTo Items to Users SendTo Directory
MD "$PDC\@UserID\SendTo"
Copy "$PDC\netlogon\each station\various\sendto\*.*" "$PDC\@UserID\SendTo\" /h
; If Restart is required, display Message Box, setup Restart code and return to Calling Script
If $Restart = "Yes"
Call "Log Updates.kix"
Play file "c:\windows\dialog.spk"
$Result = MessageBox("Windows will now be Restarted in order to Update various System Files" + $LineBreak + $LineBreak + "Please Logon again once the System has Restarted" + $LineBreak + $LineBreak + "Do NOT touch the Keyboard or Mouse until the computer has Restarted","Notice",4096,10)
$Result = WriteValue("HKEY_CURRENT_USER\Control Panel\Colors","Background","0 0 0","REG_SZ")
$Result = WriteValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","ForcedLogoff","%WinDir%\Shutdown.exe /reboot /nologo /nocancel /seconds:5","REG_SZ")
$Result = WriteProfileString("$PDC\@userid\System\LoggedOn.ini","Network","LoggedOn","No")
$Result = WriteProfileString("$PDC\@userid\System\LoggedOn.ini","Network","WkSta",@WkSta)
$Result = WriteProfileString("$PDC\@userid\System\LoggedOn.ini","Network","IT","No")
Endif
<Code>