Configuring Time Zones from a command line


Last week I was working with a client and I needed to be able to configure the timezone on machines automatically by some form of automated process.  The workstations we needed to configure were spread across 5 separate time zones in Australia and New Zealand.  Digging into this some more, I found that I could easily set the time zone based on a command line script as below.

"control.exe timedate.cpl,,/Z (GMT+10:00) Canberra, Melbourne, Sydney"

You can easily change the section after the /Z to be the exact same text as what you see when you go to change the time zone manually.

I elected to create 5 individual batch files and then call those batch files from the existing site specific logon scripts.  This way when we move a PC to a site, and the local user logs on, it will set the time zone correctly. 

I also explored the option of setting this as a computer startup script via Group Policy. Doing it this way would have meant that I could apply a GPO to the specific site via Active Directory Sites and Services that would automatically affect all computers in that sites IP subnet.  In the end though the reason I chose not to do this was that it would also affect travelling users who visit a remote office.  When the travelling user connects their PC to the LAN, they are immediately in that local site, and therefore if they rebooted their computer while on that site, their time zone settings would have been modified.  This would have had the side effect of ALSO changing their outlook calendar appointments which would have caused much confusion.

Published: 18/06/2008 8:36 AM

Leave a Reply

Your email address will not be published. Required fields are marked *