I've experimented with a couple of WMI features that don't seem to work. For
example, the Win32_ComputerSystem object has a CurrentTimeZone property that
is read/write, but when I write a value to it, the computer's actual
timezone doesn't actually get changed. I did set the
"SeSystemTimePrivilege", so I don't think the problem was insufficient
privileges. Instead, this appears to be one of many WMI properties that are
writeable but do not have any actual effect on the system.
I thought the Win32_OperatingSystem.SetDateTime method might work, as the
last three digits specify an offset for the timezone. However, on
experimenting with it, it appears that those digits only affect the way the
time value is interpreted, without changing the current timezone on the
system.
I'm on XP SP2, and the script needs to work on XP and W2K3.
Thanks in advance for any suggestions.
Hi
Time zone change using the command line utility Control.exe
(Win2k/WinXP/Win2k3):
Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada); Tijuana
alternatively:
RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-08:00) Pacific
Time (US & Canada); Tijuana
where '(GMT-08:00) Pacific Time (US & Canada); Tijuana' is the timezone to
be set.
Input value behind /Z is from the Display value under the registry key
'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'
You can use the Std value in those registry keys as well, this is equivalent
with "(GMT-08:00) Pacific Time (US & Canada); Tijuana":
Control.exe TIMEDATE.CPL,,/Z Pacific Standard Time
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
Thanks! This works great and will be very handy.
Thanks!