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
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
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