Daylight Saving Hour Change Handling

First, Run the update patch provided by microsoft to update your Daylight Saving Hour for your time zone,

If the Patch is not available, or for some reason you need an alternative, Here’s some:

1- ZEdit.exe : useful tool with GUI to set the Daylight Saving Hour change dates, could be used if you have small no. of computers in place.

2- timezone.exe: a command line tool, that could be called from a patch file on the startup script, example:

@echo off
\\FileServer\DST\timezone.exe /s 23:4:5:04 23:4:3:08

3- Registry -Use this with Caution-: you can update the DST on a single machine (by any way), then extract the time zoon registry key and import it -By batch file- an the other machines,

additionally you will need to refresh the control set, so the settings take effect

For Egypt Standared Time:

Export: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time]
"Display"="(GMT+02:00) Cairo"
"Dlt"="Egypt Daylight Time"
"Std"="Egypt Standard Time"
"MapID"="4,68"
"Index"=dword:00000078
"TZI"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,08,00,04,00,03,00,17,00,3b,\
00,3b,00,00,00,00,00,04,00,04,00,05,00,17,00,3b,00,3b,00,00,00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time\Dynamic DST]
"FirstEntry"=dword:000007d5
"LastEntry"=dword:000007da
"2005"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,09,00,04,00,05,00,17,00,\
3b,00,3b,00,e7,03,00,00,04,00,05,00,05,00,00,00,00,00,00,00,00,00
"2006"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,09,00,04,00,03,00,17,00,\
3b,00,3b,00,e7,03,00,00,04,00,05,00,05,00,00,00,00,00,00,00,00,00
"2007"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,09,00,04,00,01,00,17,00,\
3b,00,3b,00,e7,03,00,00,04,00,04,00,05,00,17,00,3b,00,3b,00,e7,03
"2008"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,08,00,04,00,05,00,17,00,\
3b,00,3b,00,e7,03,00,00,04,00,04,00,05,00,17,00,3b,00,3b,00,e7,03
"2009"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,08,00,04,00,03,00,17,00,\
3b,00,3b,00,e7,03,00,00,04,00,04,00,04,00,17,00,3b,00,3b,00,e7,03
"2010"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,09,00,04,00,05,00,17,00,\
3b,00,3b,00,e7,03,00,00,04,00,04,00,05,00,17,00,3b,00,3b,00,e7,03

To Refresh control set: run this VBS Script:

Set objSh = CreateObject("WScript.Shell")

‘Get the StandardName key of the current time zone
szStandardName = objSh.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\StandardName")

‘Enumerate the subkeys in the time zone database
const HKEY_LOCAL_MACHINE = &H80000002
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
szTzsKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
objReg.EnumKey HKEY_LOCAL_MACHINE, szTzsKeyPath, arrTzSubKeys

‘Step through the time zones to find the matching Standard Name
szTzKey = "<Unknown>"
For Each subkey In arrTzSubKeys
If (objSh.RegRead("HKLM\" & szTzsKeyPath & "\" & subkey & "\Std") = szStandardName) Then
‘Found matching StandardName, now store this time zone key name
szTzKey = subkey
End If
Next

If szTzKey = "<Unknown>" Then
‘Write entry to the Application event log stating that the update has failed to execute
objSh.LogEvent 1, "DST 2007 Registry Update and Refresh failed to execute on this computer. Time zones failed to enumerate properly or matching time zone not found."
Wscript.Quit 0
End If

Dim process, processid, result, strUpdateCommand
Set process = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2:Win32_process")

‘Add time change privilege to the process object
process.Security_.Privileges.AddAsString "SeSystemTimePrivilege",True
strUpdateCommand = "control.exe timedate.cpl,,/Z" & szTzKey

‘Launch control.exe to refresh time zone information using the TZ key name obtained above
result = process.create(strUpdateCommand,Null,Null,processid)
If result <> 0 Then
objSh.LogEvent 1, "DST 2007 Registry Update and Refresh failed to execute on this computer. Unable to refresh the Timezone database."
Wscript.Quit 0
End If

‘Get current display name of refreshed time zone
szCurrDispName = objSh.RegRead("HKLM\" & szTzsKeyPath & "\" & szTzKey & "\Display")

‘Write entry to the Application event log stating that the update has executed
objSh.LogEvent 4, "DST 2007 Registry Update and Refresh has been executed on this computer." & chr(13) & chr(10) & chr(13) & chr(10) & "Current time zone is: " & szCurrDispName & "."

And the startup script would look like:

@echo off
Regedit /s \\FileServer\DST\\TZUpdate.reg
Cscript \\FileServer\DST\\RefreshTZinfo.vbs

Useful Commands to Use With Windows Time:

Net stop w32time & Net start w32time

NET TIME /QuerySNTP
NET TIME /SETSNTP:10.x.x.x

w32tm /resync
w32tm /tz –> Display time zone

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s