WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Set Daylight Savings Time 2007


Question:

Has anyone developed any code for scripting the 2007 DST change on Windows?

The daylight savings time issue coming up in March of 2007. Microsoft is apparently not releasing a patch for any OS other than XP and Server 2003. I am creating a script that will "patch" the older operating systems. But before I do, I thought I'd check to see if someone has already done this.

Answer:

'Preparing for daylight saving time changes in 2007'

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

'How to configure daylight saving time for the United States in 2007'

http://support.microsoft.com/kb/914387

For Windows 2000, see this article: http://www.intelliadmin.com/blog/2007/01/unofficial-windows-2000-daylight.html

Note: "Microsoft is providing a hotfix - but only to the companies that have an extended support contract."

Also of note is that the DST patch for Windows XP SP2 also works on XP SP1 although it is only officially supported on SP2.

See Also:
Script: DST Adjustments for All Windows Computers
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Time~-~Timer~and~Date~Functions+DST~Adjustments~for~All~Windows~Computers.txt


More

We thought we had the daylight time change taken care of last March, when we patched all of our machines. Then the boss (of all people) noticed one of his calendar items for next week was an hour off. It turns out that a few new machines got installed during the summer without the daylight time patches.

Here is a quick and dirty script I wrote to scan the network and find any computers with the wrong setting.

It uses the WinNT extender to get a list of computers on the network. It reads the daylight-time-ends setting from the registry of each machine (so whoever runs it must have permission to do that) and writes a log showing the end-date on each machine.

For any machine where the end date is not "First Sunday of November" it also pops up a dialog, so you'll see the problems right away.




AddExtender("WWWNT34i.DLL")
Machines = wntServerList("","",4096)     ;return a list of all Windows NT (either workstation or server)
MachineCount = ItemCount(Machines,@TAB)

hLog = FileOpen("ZoneScan.Log","WRITE")

For xMachine = 1 To MachineCount
   Computer = ItemExtract(xMachine,MAchines,@TAB)

   EM = ErrorMode(@OFF)
   RReg=RegConnect(Computer, @REGMACHINE)
   If RReg == 0
       FileWrite(hLog,StrCat(StrFix(StrCat(Computer," "),".",20),"Could not read the registry."))
       Message(Computer,"Could not read the registry.")
       Continue
   End If

   TZI=RegQueryBin(RReg, "SYSTEM\CurrentControlSet\Control\TimeZoneInformation[StandardStart]")
   RegCloseKey(RReg)
   ErrorMode(EM)
   If TZI == 0 Then
       FileWrite(hLog,StrCat(StrFix(StrCat(Computer," "),".",20),"Could not read the registry."))
       Message(Computer,"Could not read the registry.")
       Continue
   End If

   Month = ItemExtract(3,TZI," ")
   Day   = ItemExtract(15,TZI," ")
   Week  = ItemExtract(5,TZI," ")
   Hour  = ItemExtract(7,TZI," ")

   xWeek  = ItemLocate(Week, "01.02.03.04.05",".")
   xDay   = ItemLocate(Day,  "00.01.02.03.04.05.06",".")
   xMonth = ItemLocate(Month,"01.02.03.04.05.06.07.08.09.0A.0B.0C",".")

   If xWeek == 0 || xDay == 0 || xMonth == 0
       FileWrite(hLog,StrCat(StrFix(StrCat(Computer," "),".",20),"Unknown values in registry."))
       Message(Computer,"Unknown values in registry.")
       Continue
   End If
   Week =  ItemExtract(xWeek,"First.Second.Third.Fourth.Last",".")
   Day   = ItemExtract(xDay,"Sunday.Monday.Tuesday.Wednesday.Thursday.Friday.Saturday",".")
   Month = ItemExtract(xMonth,"January.February.March.April.May.June.July.August.September.October.November.December",".")
   DisplayLine  = StrCat(Week," ",Day," of ",Month," at ",Hour,":00")

   FileWrite(hLog,StrCat(StrFix(StrCat(Computer," "),".",20),DisplayLine))
   If Week != "First" || Month != "November" || Day != "Sunday"
        Message(Computer,DisplayLine)
   EndIf
Next
FileClose(hLog)
Message("","Done")
Return

Article ID:   W17275
File Created: 2014:07:18:09:51:40
Last Updated: 2014:07:18:09:51:40