DST 2007 - Windows Clients / Servers changed time erroneously
Published Mar 15 2019 05:44 PM 400 Views
Microsoft
First published on TECHNET on Oct 31, 2007


As we get closer to the DST change here in the US, we have received some reports from a few customers that the system time erroneously reverted back an hour last Sunday (October 28).  On these systems the customers did have KB931386 and / or KB933360 installed.  What we have found from reviewing the data provided by these customers that the affected clients appeared to have some unexpected registry values, as shown in the keys below (the bold / red sections are the pertinent values)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\StandardStart: 00,00, 0a ,00, 05 ,00, 02 ,00,00,00,00,00,00,00,00,00

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightStart: 00,00, 04 ,00, 01 ,00, 02 ,00,00,00,00,00,00,00,00,00

In order to recover from this scenario, you can use either of the recovery methods below.

Method 1 - Use the "Date & Time" Control Panel Applet: Assuming that the user has the rights to modify the system clock, they can do the following.

  1. Using the “Date and Time” Control Panel applet, change the time zone of the client to one outside of the one they are in, then apply the change.
  2. Change back to the correct time zone, then apply the change and close the applet.

Method 2 - Use a single command-line statement OR the RefreshTZInfo.vbs script provided below: If the user does not have the rights to modify the system-clock, then either of the methods below can be used to push the refresh to multiple clients

First recovery option - single command-line statement:  Add the following statement to a login script or batch file: control.exe timedate.cpl,,/Z Time Zone Name

For Example: control.exe timedate.cpl,,/Z Eastern Standard Time

Note that this method assumes you know the name of the time zone of the client that you will be running the command on. If you have clients in multiple time zones, see the second recovery option below.

Second recovery option - the RefreshTZInfo.vbs Script:  Cut & paste the script below into notepad or another text editor, and name it RefreshTZInfo.vbs.  Deploy this script via group policy or other deployment mechanism.  See KB 914387 for more details about how to deploy this script.  The script is also attached to this post as a text file.

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 & "."

After using either of the methods above, the registry keys for the affected clients should look like the ones below and properly modify their time correctly at 2:00 a.m. on November 4.


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\StandardStart: 00,00, 0b ,00, 01 ,00, 02 ,00,00,00,00,00,00,00,00,00


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightStart: 00,00, 03 ,00, 02 ,00, 02 ,00,00,00,00,00,00,00,00,00


As always, please test any changes in a controlled environment before deployment to production.  That's it for this post - the main Microsoft resources for DST are listed below.  Until next time ...


Additional Resources:



- CC Hameed


EDIT (11/2/2007):  Please see Microsoft KB Article 944524 for more information on this issue


RefreshTZInfo.txt

Version history
Last update:
‎Mar 15 2019 05:45 PM
Updated by: