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.

WinBatch and Daylight Savings Time 2007


The United States and parts of Canada are extending the period of Daylight Saving Time (DST) beginning in 2007. From 2007 onward, DST will commence on the second Sunday in March (three weeks earlier than previously) and end on the first Sunday in November (a one week extension).

This is mandated by the Energy Policy Act of 2005. For more information regarding the Energy Policy Act of 2005, refer to the Department of Energy Web site: http://www.energy.gov/about/EPAct.htm

The WinBatch software itself should not be affected by the upcoming ( March 2007 ) Daylight Savings Time change. The WinBatch software simply references the SYSTEM date and time. Note: it is the responsibility of the script developer to address any DST problems in their own scripts.

We recommend applying the appropriate Microsoft Windows DST patches.

To ensure that your Wilson WindowWare software products will work as expected in 2007, it is recommended that the operating system be updated per Microsoft's instructions.

"Preparing for Daylight Saving Time changes in 2007" http://www.microsoft.com/windows/timezone/dst2007.mspx

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:   W17276
File Created: 2014:07:18:09:51:40
Last Updated: 2014:07:18:09:51:40