To Install DST Patches Remotly on Multiple Servers
We have a lot of “non standard” servers for whatever reasons. In order to facilitate the DST patch push. I put together an Ad Hoc script to push DST patch to server otherwise can’t be pushed through SMS or Opsware.
First I download psexec.exe from http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx
Then I run the following VBS script on my computer. What this script does is to copy the “DST” folder to the targeted servers. Then I will use psexec to kick off the dst.bat file on each target server.
dst.vbs:
******************************************************************
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set InputFile = oFSO.OpenTextFile("C:\MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
sSourceFolder = "C:\DST"
sDestFolderName= "DST"
sDestFolder = "\\" & strComputer & "\C$\" & sDestFolderName
oFSO.CopyFolder sSourceFolder, sDestFolder
Set objShell = CreateObject("WScript.Shell")
objShell.Run("%comspec% /K psexec.exe \\" & strComputer & " -i C:\dst\dst.bat"), 1, True
Loop
InputFile.Close
*********************************************************************
Here is the contents of DST folder:
dst.bat
OSVER.EXE
TimeZoneupd.reg (NT)
TimeZoneUpdate.exe (NT)
Windows2000-KB931836-x86-ENU.EXE
WindowsServer2003-KB931836-x86-ENU.exe
The OSVER.EXE is from Bill Stewart's Site. OSVER allows a batch file to perform operating system platform checking. It can differentiate between Windows 95, Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, and Windows Server 2003.
I use Windows OS detection script by Doc Rice as a template and modified it to create my dst.bat file. What it does is to check the Windows OS version on the remote targets and then install the applicable patch.
dst.bat:
**************************************************************
@echo off
for /f "tokens=*" %%i in ('c:\dst\osver.exe') do set windowsversion=%%i
echo This operating system is %windowsversion%.
echo.
if "%windowsversion%" == "Windows NT 4.0" goto windowsnt
if "%windowsversion%" == "Windows 2000" goto windows2000
if "%windowsversion%" == "Windows Server 2003" goto windows2003
:windowsnt
call c:\dst\TimeZoneUpdate.exe
goto end
:windows2000
call C:\dst\Windows2000-KB931836-x86-ENU.EXE /quiet /norestart
goto end
:windows2003
call c:\dst\WindowsServer2003-KB931836-x86-ENU.exe /quiet /norestart
goto end
:end
****************************************************************
Thanks Bill Stewart and Doc Rice for their contribution!