I have been using WSH files to install patches on WIndows 2000 PCs in my organization. It works pretty well. I am able to look for and copy placeholder files to the local pc so that the script will only run once. At the bottom of my script, the physical file locations are defined. As long as Windows is installed to the C:\windows folder, the script works great. However, some of my WIndows PCs are installed to C:\winnt and so I need to use something like %systemroot% instead of c:\windows or c:\winnt. Any ideas on how to make this work?
See my code below:
Function Update( data, pc, command, loginsc )
Dim f1
if fs.FileExists( PC ) then
wscript.quit
else
if fd.FileExists( data ) then
set f1 = fs.GetFile( loginsc )
f1.Copy pc,True
wshShell.Run( command )
WshShell.Popup “Installing an Update” &chr(13)& “Click OK to continue”,30, “MS03-008 JScript 5.6 Security Patch”, 64
WScript.Sleep 300
else
wscript.quit
end if
end if
End Function
Dim fs, fd
set fs = WScript.CreateObject(“Scripting.FileSystemObject”)
set fd = WScript.CreateObject(“Scripting.FileSystemObject”)
set wshShell = WScript.CreateObject(“WScript.Shell”)
f = “f:\winapps\win2k\ms03-008.exe”
c = “C:\windows\install_MS03-008.vbs”
r = “f:\winapps\win2k\ms03-008.exe /q /r:n”
z = “z:\public\loginsc\install_MS03-008.vbs”
update f, c, r, z