Jump to content

Day Saver - DST 2007 Updater


ReverendJ1
 Share

Recommended Posts

I have written a program to update the daylight savings time on one or more computers at a time. This will make getting computers DST 2007 (the new daylight savings time change) compliant a lot easier than manually using the TZEdit tool provided by Microsoft on every computer.

Features:

- Adaptable, meaning you can use it for whatever DST change there is, although the changes for DST2007 are the defaults

- Should update the DST for Win 9x, ME, NT, 2000, 2003* or XP. (Vista not supported, I am not sure what would happen if it was run on a Vista machine. Vista has the updated DST info anyway.)

- You can update the computer the program is run on

- You can update just a single remote computer

- You can update a list of computers (stored as a csv file in the program folder, so you can easily export a computer list from Excel or Access)

- You can update an IP range

- Allows yo to run as many commands as you want after the update (useful for other DST patches)

- Full printable report once complete

To run this you will need administrative rights on all computers you want to update, have remote registry turned on, as well as admin shares. Your users may also notice the Time Zone control panel applet pop up for a split second on their screen, but it shouldn't affect their work. This will work on users who are logged off too, but they will have to manually close the Time Zone control panel applet window once they log in. If you used the old version (1.0) you will need to redo it with this version, (sorry) otherwise the time zone information will not change unless an administrator opens up and closes each users Time Zone control panel applet.

I got it hosted on Sourceforge.net so you can download it there.

Day Saver 1.5 Source

Day Saver 1.5 No Install

Day Saver 1.5 Setup

You may also visit my webpage I made for it. I made some quick and dirty documentation for it there.

http://johnny5source.googlepages.com/daysaver

Let me know what you think. I figure it should save any network admin with 50 or more pre-XP machines about a day of manually running the TZEdit program on each machine, hence half the reason for the name.

***NOTE*** - There have been a couple reports of this program deleting the Eastern Time Zone when run on Windows 2003 servers. Please be weary when running on a Windows 2003 server until this bug has been fixed. If this happens, you can download Microsoft's TZEdit here (Windows NT, 2000, XP or 2003) or here (Windows 95, 98 or ME).

*Edit - Updated everything for new version.

Edited by ReverendJ1
Link to comment
Share on other sites

This is a fantastic idea and I can definitely, definitely, use it. One thing I didn't see though: have you tested it? :whistle: j/k.

I'll look over the source, but this aught to really make my job easy, you rock.

Link to comment
Share on other sites

@fsifo - Thank you for the praise, it makes it all worth it. I figured I could spend a day or two writing a program to do this automatically, and hopefully help save a lot of time for a lot of other people, or I can spend a day or two manually changing everyone's DST information.

As far as testing goes, I tested it on a few machines (Win 2000 and XP). I don't have any pre-Win 2000 machines to test it on, but it should work. It knows the difference between Windows versions and makes changes accordingly. Basically it just makes a few registry changes, which if you have read anything about any of the Microsoft solutions, that is exactly what they do too. If anyone wants to test and let me know how it works for them, that would be great. I also have only RUN the program from Win XP, but have updated 65+ Win 2000 & XP machines successfully.

Also, sorry about the no comments in the source code, I have a bad habit of writing programs and then putting in the comments later. I will add them as soon as I get time, and re-release it. I think I make my code fairly easy to read anyway. At least it is for me. :whistle:

Link to comment
Share on other sites

@fsifo - Thank you for the praise, it makes it all worth it. I figured I could spend a day or two writing a program to do this automatically, and hopefully help save a lot of time for a lot of other people, or I can spend a day or two manually changing everyone's DST information.

As far as testing goes, I tested it on a few machines (Win 2000 and XP). I don't have any pre-Win 2000 machines to test it on, but it should work. It knows the difference between Windows versions and makes changes accordingly. Basically it just makes a few registry changes, which if you have read anything about any of the Microsoft solutions, that is exactly what they do too. If anyone wants to test and let me know how it works for them, that would be great. I also have only RUN the program from Win XP, but have updated 65+ Win 2000 & XP machines successfully.

Also, sorry about the no comments in the source code, I have a bad habit of writing programs and then putting in the comments later. I will add them as soon as I get time, and re-release it. I think I make my code fairly easy to read anyway. At least it is for me. :)

No worries on the comments, it was fairly straightforward to figure it out. Now I just wish your code could handle exchange servers :whistle:

Anyway, I'll be rolling this out in the next week or two, so I'll be sure to report back on performance... thanks again!

Link to comment
Share on other sites

  • 2 weeks later...

I noticed a small bug that I'm working on with Day Saver. It does not actually update the time zone information unless you open up the Time Zone control panel applet. I am working on fixing this and will post an update once I get it figured out.

First off, great script! It has helped me update a crap load of windows 2000 computers in our network. I recently noticed the time zone refresh problem myself, and there is a vbs script that M$ provides. Maybe you can incorporate the code into your script. Here is the site from M$: http://support.microsoft.com/kb/914387

Keep up the great work!

Eric

Link to comment
Share on other sites

@

I did a quick translation for those who need it (I don't :whistle: )

; http://support.microsoft.com/kb/914387
; Refresh TZI info for USA

Dim $objReg, $objSh, $szTzsKeyPath, $arrTzSubKeys

$objSh = ObjCreate("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 = 0x80000002 
 $objReg=ObjGet("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 $subkey In $arrTzSubKeys
    If ($objSh.RegRead("HKLM\" & $szTzsKeyPath & "\" & $subkey & "\Std") = $szStandardName) Then
        ;Found matching StandardName, now store this time zone key name
        $szTzKey = $subkey
    EndIf
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.")
;VA        Wscript.Quit 0
EndIf

;Launch control.exe to refresh time zone information using the TZ key name obtained above 
$objSh.Run ("control.exe timedate.cpl,,/Z" & $szTzKey)

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

Enjoy !!

ptrex

Link to comment
Share on other sites

Thanks guys. I already had that part figured out though. :whistle: Well, the important part at least ("control.exe timedate.cpl,,/Z") which will open up the Time Zone Applet. I think I got the rest of this just about done. Sorry for the delay, I've been busy at work with other projects. I SHOULD be able to post a final today.

Link to comment
Share on other sites

Day Saver is now complete! (I think) It now actually updates the DST information, instead of just making the registry change. Thanks Dufran3 for pointing that out! It also allows you to run as many commands afterwards as you want, so you can use it to do other DST patches as well!

Link to comment
Share on other sites

Day Saver is now complete!

Solid job with the execution. I did find a couple of niggles that I would pass along as suggestions:

1) When updating a list of computers, providing the results in csv (or other flatfile) format would be preferable to an html based report,

to enable network admins to quickly isolate the 'problem children'.

2) I found the report.html layout unclear -- It was not immediately apparent that there was not an error. I would recommend a result line per host, in some kind of table format for clarity and readability. The error descriptions more properly belong in a footer, IMO.

3) There is no way out if you decide you want to cancel while entering data in some of the fields -- like an ip range.

Again, great job w/ the core functionality! Thank you for sharing this with the community.

I have tested 1.5 with both windows 2000 pro and w2k advanced server with positive results. Planning a full rollout shortly.

Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

@flyingboz - Thank you for using my program. It makes me very happy to hear people are getting good use of this. :whistle: I tried to make the report as easy as possible. It very quickly shows with who and what the problems are. If the computer name is in the 'Success' column then everything ran fine and the time zone info was updated correctly. If it is in the 'Could Not Ping' column then the computer could not be pinged, hence is probably not on. If it is in the 'Could Not Connect' column, then it means Day Saver couldn't connect to it, meaning you probably aren't an administrator on the remote machine, or the firewall is turned on. The machine name will show up under 'Registry Error' if there was a problem writing to the registry. I don't see how a csv file could be any easier.

Putting it in an html report also allows me to open it up for printing and allow formatting. The error descriptions are basically in a footer. I mean they go after the last computer anyways.

As far as allowing you to cancel out of some of the data fields, it was something I planned on adding, but never got around to it. I was mostly focused on making it work and getting it out in enough time that people could use it. I guess I could now, but it would be kind of late, seeing as how Daylight Savings Time is in 4 days. :P

-J5

Link to comment
Share on other sites

@J1

ty for keeping me from having to do it all myself, i found you on a forum search before

jumping in to write it. :whistle:

I'll make the mods I want /need to your code (presuming your permission.)

If you are interested, I'd be happy to PM or post the diffs.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

@J1

ty for keeping me from having to do it all myself, i found you on a forum search before

jumping in to write it. :whistle:

I'll make the mods I want /need to your code (presuming your permission.)

If you are interested, I'd be happy to PM or post the diffs.

Could you post or PM me please? I need to update 80 Win 2000 computers tonight or tomorrow night. :P

-John

Link to comment
Share on other sites

Sorry about the late replies, for some reason my email notification isn't working right.

@flyingboz - I don't care if you change the program to suit your needs. Thats what its all about. :whistle: Please post it here in case other people would want export to csv functionality.

@jftuga - You can use the program/source included at the beginning of this post to update your machines. Flyingboz just wanted to make a couple adjustments to it.

Link to comment
Share on other sites

I need help - I ran this on a 2003 server and now I have no EST listed - anyhelp? Also it did not look like it took as I had to change the time manually, not sure - it did run fine on the the other 15 or so computers, had some issues with 3 others, but I did the server with the application running local and remote - same issue - EDIT could not run remotely.

So between:

Bogota, Lima, Quinto

NOTHING - no Eastern Time (Us & Canada)

Indiana (East)

Thanks for your help.

EDIT - I have looked at the code and I may just manually add the entry back - i hope this works, what I am doing is taking another pc and exporting the entry for EST and then going to import it into the server

Edited by nitekram

2¢

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I need help - I ran this on a 2003 server

If you have latest service packs uploaded, you have no need to run this on an xp or 2003 box...

I suppose the code could be modified to keep you from doing something silly, a la

if @OStype ....

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

If you have latest service packs uploaded, you have no need to run this on an xp or 2003 box...

I suppose the code could be modified to keep you from doing something silly, a la

if @OStype ....
Well in this case the server was not update (my fault - *BAD ADMIN* - was planning upgrade at end of this quarter, changed to today). Anyway the REG inport did not work, even after telling everyone to get off the server to do a reboot. I ended up downloading the patch from MS and it put everything back in place - and YES I am back seeing EST (that was weird though).

Thanks for the help anyway.

2¢

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I did something like this about a week ago, except my problem was finding which of our XP computers had SP2 and the patch and which ones didn't. I hacked a VB script to give me a quick report of the computers on our domain in this respect. We had to install SP2 on quite a few XP boxes and then I manually updated the rest.

This is a great utility, but I would suggest all the admins get their XP clients up to date with SP2 and then install the KB931836 patch to get the daylight savings time update. Took us a while here, but we learned which clients weren't updating correctly.

Link to comment
Share on other sites

Sorry for the late reply, I am not getting my email notifications for some reason. There does seem to be a bug in it when it comes across a Server 2003 box. I have received one other report of this happening, but have no 2k3 box to check. I assume it is not correctly determining the OS for Windows 2003 machines. If this happens, you can download Microsoft's TZEdit here (Windows NT, 2000, XP or 2003) or here (Windows 95, 98 or ME).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...