daylight savings changes for 2007

figgie

Supreme [H]ardness
Joined
Feb 11, 2002
Messages
7,829
This script is not valuable to one off folks

Now for enterpise computers. This will make the changes a breeze!
This is compatabile with

windows 2000
Windows XP
Windows 2003

Code:
Const HKEY_LOCAL_MACHINE = &H80000002
Const ForReading = 1

arrOldValue = 0
arrInValue = 0

Set objArgs = Wscript.Arguments
Set objFSO = CreateObject("Scripting.FilesystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")

'Used for retrieving arguments from a text file.
'example: cscript dsttest.vbs c:\scripts\allserver.txt 
'Must Declare objArgs, objDictionary and objFSO above

Set objTextFile = objFSO.OpenTextFile(objArgs(0), ForReading)

i=1
Do Until objTextFile.AtEndOfStream
	strNextLine = objTextFile.Readline
	objDictionary.Add i, strNextLine
	i=i+1
Loop

For Each objItem in ObjDictionary
	
strComputer = ObjDictionary.Item(ObjItem)
'the following IF statement is used to exit without the script reporting back a null value
If objItem = i-1 Then Exit For 
  Wscript.Echo
  Wscript.Echo strComputer

'WMI connection
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Central Standard Time"
strValueName = "Display"
strTZIName = "TZI"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'Used to write a binary value. Value must be in Decimal Format (104 becomes 68h)
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
	wscript.StdOut.Write "Old: "
	 
    For Each byteValue in arrOldValue
    wscript.StdOut.Write byteValue & " "
  Next
  
  wscript.echo
  'array value is the NEW Central daylight saving time date and standard date
  arrValues = Array(104,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)


errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrValues)	

If IsNull(strValue) Then
    Wscript.Echo "The registry key does not exist."
Else
    wscript.StdOut.Write "New: "
      
   For Each byteNewValue in arrValues
     wscript.StdOut.Write byteNewValue & " "
   Next
  Wscript.Echo
End If

Next

objTextFile.Close

Just a couple of notes

you must use a text file for input

daylighsavings.vbs serverlist.txt > updateddts.txt

this script will output server name, the old value and the new value.
It is currently only set to work in central standard time zone but it is not difficult to add an if else statement for the other time zones.

Also if you want

http://www.microsoft.com/windows/timezone/dst2007.mspx

This works for one offs also.

-figgie
 
ok gents

March 11th is fast approaching!

that script on top was prelim and it worked fine..

This one on the otherhand is the one "we" used for production.

250+ server in 5 minutes ;)

Disclosure: I am putting this out here free of charge but also with no warranty either expressed or implied. You use this at your own risk.

Code:
' ### Created by 
' ### Figgie, Windows Systems Administrator
' ### December 13, 2006
' ### Rev 1.0.0
' ### January 31, 2007
' ### Rev 2.1.0
 
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Const ForReading = 1
strValueName = "Display"
strTZIName = "TZI"
' Array assignments for each time zone in the United States
arrOldValue = 0
arrNewfoundland = Array(210,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrAtlantic = Array(240,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrEastern = Array(44,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrCentral = Array(104,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrMountain = Array(164,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrPacific = Array(224,1,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrAlaska = Array(28,2,0,0,0,0,0,0,196,255,255,255,0,0,11,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,2,0,0,0,0,0,0,0)
arrDSTStartIn = Array(0,0,3,0,2,0,2,0,0,0,0,0,0,0,0,0)
arrDSTEndIn = Array(0,0,11,0,1,0,2,0,0,0,0,0,0,0,0,0) 
' Roll back information for pre-2007 time zones in USA and canada.
' arrNewfoundland = Array(210,1,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrAtlantic = Array(240,1,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrEastern = Array(44,1,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrCentral = Array(104,1,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrMountain = Array(164,1,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrPacific = Array(224,1,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrAlaska = Array(28,2,0,0,0,0,0,0,196,255,255,255,0,0,10,0,0,0,5,0,2,0,0,0,0,0,0,0,0,0,4,0,0,0,1,0,2,0,0,0,0,0,0,0)
' arrDSTStartIn = Array(0,0,4,0,1,0,2,0,0,0,0,0,0,0,0,0)
' arrDSTEndIn = Array(0,0,10,0,5,0,2,0,0,0,0,0,0,0,0,0)
 
Set objArgs = Wscript.Arguments
Set objFSO = CreateObject("Scripting.FilesystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
 
If Wscript.Arguments.Count = 0 Then
Wscript.Echo "You must enter the computer name when starting this script."
Wscript.Quit
End If
 
'Used for retrieving arguments from a text file.
'example: cscript dsttest.vbs c:\scripts\allserver.txt 
'Must Declare objArgs, objDictionary and objFSO above
Set objTextFile = objFSO.OpenTextFile(objArgs(0), ForReading)
WScript.StdOut.Write "Hostname,Standard Name,Day Light Name,DST AutoOn,Newfoundland TZ - Old,Newfoundland TZ - New,"_
& "Atlantic TZ - Old,Atlantic TZ - New,"_
& "Eastern TZ - Old,Eastern TZ - New," _
& "Central TZ - Old,Central TZ - New,Mountain TZ - Old,Mountain TZ - New," _
& "Pacific TZ - Old,Pacific TZ - New,Alaskan TZ,Old DST Start," _
& "New DST Start,Old DST End,New DST End" & VbCrLf
i=1
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i=i+1
Loop
For Each objItem in objDictionary
 
strComputer = ObjDictionary.Item(ObjItem)
'the following IF statement is used to exit without the script reporting back a null value
If objItem = i-1 Then Exit For 
 
 
WScript.StdOut.Write strComputer
'WMI connection
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
If Err = 0 Then
strCCSKeyPath = "System\CurrentControlSet\Control\TimeZoneInformation"
strSTDTZIName = "StandardName"
strDSTTZIName = "DaylightName"
strDSTStart = "DaylightStart"
strDSTend = "StandardStart"
strSetDSTAutoName = "DisableAutoDaylightTimeSet"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strSTDTZIName,strSTDTZI
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTTZIName,strDSTTZI
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strSetDSTAutoName,strDSTOnValue
 
WScript.StdOut.Write "," & strSTDTZI
WScript.StdOut.Write "," & strDSTTZI 
 
If IsNull(strDSTOnValue) Then 
wscript.stdout.write "DST auto on is turned on,"
Else
WScript.StdOut.Write"Turning off DST auto turn on.,"
objReg.DeleteDWORDValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strSetDSTAutoOn
End If
 
' Newfoundland Time Zone settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Newfoundland Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11 And arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrNewfoundland) 
WScript.StdOut.Write ","
WScript.StdOut.Write arrNewfoundland(0) & " " & MonthName(arrNewfoundland(14))& " - " & MonthName(arrNewfoundland(30))
 
End If
 
' Atlantic Time Zone settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Atlantic Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11 And arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrNewfoundland) 
WScript.StdOut.Write ","
WScript.StdOut.Write arrAtlantic(0) & " " & MonthName(arrAtlantic(14))& " - " & MonthName(arrAtlantic(30))
 
End If
 
' Eastern Time Zone settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11 And arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrEastern) 
WScript.StdOut.Write ","
WScript.StdOut.Write arrEastern(0) & " " & MonthName(arrEastern(14))& " - " & MonthName(arrEastern(30))
 
End If
 
'Central Time Zone Settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Central Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11) and (arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrCentral) 
WScript.StdOut.Write ", "
WScript.StdOut.Write arrCentral(0) & " " & MonthName(arrCentral(14)) & " - " & MonthName(arrCentral(30))
End If
 
 
'Mountain Time Zone Settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Mountain Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11 and arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrMountain) 
WScript.StdOut.Write ", "
WScript.StdOut.Write arrMountain(0) & " " & MonthName(arrMountain(14)) & " - " & MonthName(arrMountain(30))
End If
 
 
' Pacific Time Zone Settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Pacific Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11 and arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrPacific) 
WScript.StdOut.Write ", "
WScript.StdOut.Write arrPacific(0) & " " & MonthName(arrPacific(14)) & " - " & MonthName(arrPacific(30))
End If
 
 
' Alaskan Time Zone Settings
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Alaskan Standard Time"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrOldValue
If Eval (arrOldValue(14) = 11 and arrOldValue(30) = 3 ) then 
WScript.StdOut.Write ",Registry Key is up to date.,"
Else
WScript.StdOut.Write ","
WScript.StdOut.Write arrOldValue(0) & " " & MonthName(arrOldValue(14)) & " - " & MonthName(arrOldValue(30))
' array value is the NEW Eastern daylight saving time start and end date
' Used to get a binary value. Value must be in Decimal Format (104 becomes 68h)
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strKeyPath,strTZIName,arrAlaska) 
WScript.StdOut.Write ","
WScript.StdOut.Write arrAlaskan(0) & " " & MonthName(arrAlaskan(14)) & " - " & MonthName(arrAlaskan(30))
End If
 
' This selects the case according to the current running timezoneInformation
' under HKLM\System\CurrentControlSet\Control\TimeZoneInformation
 
Select Case strSTDTZI
 
Case "Newfoundland Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If
 
Case "Atlantic Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If
 
Case "Eastern Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If 
Case "Central Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If
 
Case "Mountain Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If
 
Case "Pacific Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If
 
Case "Alaskan Standard Time"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartOut
objReg.GetBinaryValue HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndOut
If Eval (arrDSTStartOut(2) = 3) Then
WScript.StdOut.Write "TimeZone Information is up to date.," & VbCrLf
Else 
WScript.StdOut.Write MonthName(arrDSTStartOut(2)) & " Week" & arrDSTStartOut(4)
' the following line sets the new registry entries for DST start.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTStart,arrDSTStartIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTStartIn(2)) & " Week" & arrDSTStartIn(4)
WScript.StdOut.Write ","
WScript.StdOut.Write MonthName(arrDSTEndOut(2)) & " Week" & arrDSTEndOut(4)
' the following line sets the new registry entries for DST End.
errReturn = ObjReg.SetBinaryValue (HKEY_LOCAL_MACHINE,strCCSKeyPath,strDSTEnd,arrDSTEndIn)
WScript.StdOut.Write "," 
WScript.StdOut.Write MonthName(arrDSTEndIn(2)) & " Week" & arrDSTEndIn(4)
WScript.StdOut.Write VbCrLf
End If
 
Case Else 
WScript.StdOut.Write "No Updates Needed." & VbCrLf
End Select
 
Else
Wscript.StdOut.Write ","& Err.Description & "," & Err.Number & VbCrLf
Err.Clear
End If
Next
objTextFile.Close

btw one quick thing. If you go through the code. Notice the OLD timezone information is commented out. if you need to roll back. Rem the new TZ info and uncomment the old info (under the rollback section).

Unlike Microsoft solution. This works in Windows 2000 (regardless of SP), XP (regardless of SP) and Windows 2003 (regardless of SP).

It does NOT work in NT 4 (yes yes ancient but you would be suprised how many companies still use NT 4).

The redirected output is comman delimeted to import into excel for quick reading!

-Figgie
 
Back
Top