Anyone know how to create a vbscript that will change the
user's time zone from a drop-down menu or some other type
of input?

Re: Time Zone Change by Robert

Robert
Wed Dec 03 12:55:13 CST 2003

I don't know if this will help, but this is the script to view the current
time zone. I haven't had time to play and see if this is read only or not.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colTimeZone = objWMIService.ExecQuery _
("Select * from Win32_TimeZone")
For Each objTimeZone in colTimeZone
Wscript.Echo "Offset: "& objTimeZone.Bias
Next

--
Robert Cohen
A legend in his own mind
--

"Steve" <stephen.d.powers@wellsfargo.com> wrote in message
news:c3a301c3b9c9$0a9cf750$a601280a@phx.gbl...
> Anyone know how to create a vbscript that will change the
> user's time zone from a drop-down menu or some other type
> of input?



Re: Time Zone Change by Steve

Steve
Wed Dec 03 13:23:48 CST 2003

Yeah, and you'd think there would be a way to change it if
you can view it, but I'm not sure how to do that. There's
got to be like a SetTimeZone function or something.
Thanks for you reply Robert.


>-----Original Message-----
>I don't know if this will help, but this is the script to
view the current
>time zone. I haven't had time to play and see if this is
read only or not.
>
>strComputer = "."
>Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
>Set colTimeZone = objWMIService.ExecQuery _
> ("Select * from Win32_TimeZone")
>For Each objTimeZone in colTimeZone
> Wscript.Echo "Offset: "& objTimeZone.Bias
>Next
>
>--
>Robert Cohen
>A legend in his own mind
>--
>
>"Steve" <stephen.d.powers@wellsfargo.com> wrote in message
>news:c3a301c3b9c9$0a9cf750$a601280a@phx.gbl...
>> Anyone know how to create a vbscript that will change
the
>> user's time zone from a drop-down menu or some other
type
>> of input?
>
>
>.
>

Re: Time Zone Change by Torgeir

Torgeir
Wed Dec 03 13:27:38 CST 2003

Steve wrote:

> Anyone know how to create a vbscript that will change the
> user's time zone from a drop-down menu or some other type
> of input?

Hi

Why not present the builtin menu:

Control.exe TIMEDATE.CPL,,1


If you need to do it from a script:

For the selection part, you can e.g. use IE from your VBScript:

http://groups.google.com/groups?selm=b86eca15.0302031023.775ef979%40posting.google.com

or alternatively use HTA as your front end
http://groups.google.com/groups?selm=3F8978D9.A2FA60B5%40hydro.com


For the actual time zone change operation:

Time zone change from command line (Win2k/WinXP):
http://groups.google.com/groups?selm=3F70A443.8434E4AF%40hydro.com

--
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



Re: Time Zone Change by Roland

Roland
Wed Dec 03 17:11:51 CST 2003

"Steve" <stephen.d.powers@wellsfargo.com> wrote in message
news:00c901c3b9d2$fa3b5910$a501280a@phx.gbl...
> Yeah, and you'd think there would be a way to change it if
> you can view it, but I'm not sure how to do that. There's
> got to be like a SetTimeZone function or something.

'Set TimeZone to GMT(-5)
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "System\ControlSet001\Control\TimeZoneInformation"

strEntryName = "ActiveTimeBias"
dwValue = 300
objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue

strEntryName = "Bias"
dwValue = 300
objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue

strEntryName = "DaylightName"
strValue = "Eastern Daylight Time"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue

strEntryName = "StandardName"
strValue = "Eastern Standard Time"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue

set objReg = nothing


'Set TimeZone to GMT(-6)
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "System\ControlSet001\Control\TimeZoneInformation"

strEntryName = "ActiveTimeBias"
dwValue = 360
objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue

strEntryName = "Bias"
dwValue = 360
objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue

strEntryName = "DaylightName"
strValue = "Central Daylight Time"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue

strEntryName = "StandardName"
strValue = "Central Standard Time"
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue

set objReg = nothing

-------------------

You may have to set more options depending on what you're setting, i.e.
Daylight Savings is not everywhere.

Source:
http://www.microsoft.com/technet/scriptcenter/scrguide/sas_reg_utys.asp


--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.



Re: Time Zone Change by Torgeir

Torgeir
Thu Dec 04 06:07:32 CST 2003

Roland Hall wrote:

> "Steve" <stephen.d.powers@wellsfargo.com> wrote in message
> news:00c901c3b9d2$fa3b5910$a501280a@phx.gbl...
> > Yeah, and you'd think there would be a way to change it if
> > you can view it, but I'm not sure how to do that. There's
> > got to be like a SetTimeZone function or something.
>
> 'Set TimeZone to GMT(-5)
> Const HKEY_LOCAL_MACHINE = &H80000002
> strComputer = "."
>
> Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
> strComputer & "\root\default:StdRegProv")
>
> strKeyPath = "System\ControlSet001\Control\TimeZoneInformation"

*Never* address the ControlSet branches with a number in it (e.g.
ControlSet001), *always* use CurrentControlSet, because you will not know what
number is current (at least not without additional registry reads and testing).

So the line above should be
strKeyPath = "System\CurrentControlSet\Control\TimeZoneInformation"


> strEntryName = "ActiveTimeBias"
> dwValue = 300
> objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue
>
> strEntryName = "Bias"
> dwValue = 300
> objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue
>
> strEntryName = "DaylightName"
> strValue = "Eastern Daylight Time"
> objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue
>
> strEntryName = "StandardName"
> strValue = "Eastern Standard Time"
> objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue
>
> set objReg = nothing
>
> 'Set TimeZone to GMT(-6)
> Const HKEY_LOCAL_MACHINE = &H80000002
> strComputer = "."
>
> Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
> strComputer & "\root\default:StdRegProv")
>
> strKeyPath = "System\ControlSet001\Control\TimeZoneInformation"

and the above as well should be changed to:

strKeyPath = "System\CurrentControlSet\Control\TimeZoneInformation"




--
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



Re: Time Zone Change by Roland

Roland
Fri Dec 05 04:03:01 CST 2003

Well, I started with that but only current changed. I thought it was
supposed to update one or the others but it didn't however, 001 changed all
of them. Why is that?

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FCF2384.A34C9DF8@hydro.com...
> Roland Hall wrote:
>
> > "Steve" <stephen.d.powers@wellsfargo.com> wrote in message
> > news:00c901c3b9d2$fa3b5910$a501280a@phx.gbl...
> > > Yeah, and you'd think there would be a way to change it if
> > > you can view it, but I'm not sure how to do that. There's
> > > got to be like a SetTimeZone function or something.
> >
> > 'Set TimeZone to GMT(-5)
> > Const HKEY_LOCAL_MACHINE = &H80000002
> > strComputer = "."
> >
> > Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
_
> > strComputer & "\root\default:StdRegProv")
> >
> > strKeyPath = "System\ControlSet001\Control\TimeZoneInformation"
>
> *Never* address the ControlSet branches with a number in it (e.g.
> ControlSet001), *always* use CurrentControlSet, because you will not know
what
> number is current (at least not without additional registry reads and
testing).
>
> So the line above should be
> strKeyPath = "System\CurrentControlSet\Control\TimeZoneInformation"
>
>
> > strEntryName = "ActiveTimeBias"
> > dwValue = 300
> > objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName,
dwValue
> >
> > strEntryName = "Bias"
> > dwValue = 300
> > objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName,
dwValue
> >
> > strEntryName = "DaylightName"
> > strValue = "Eastern Daylight Time"
> > objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName,
strValue
> >
> > strEntryName = "StandardName"
> > strValue = "Eastern Standard Time"
> > objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName,
strValue
> >
> > set objReg = nothing
> >
> > 'Set TimeZone to GMT(-6)
> > Const HKEY_LOCAL_MACHINE = &H80000002
> > strComputer = "."
> >
> > Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
_
> > strComputer & "\root\default:StdRegProv")
> >
> > strKeyPath = "System\ControlSet001\Control\TimeZoneInformation"
>
> and the above as well should be changed to:
>
> strKeyPath = "System\CurrentControlSet\Control\TimeZoneInformation"
>
>
>
>
> --
> 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
>
>



Re: Time Zone Change by Roland

Roland
Fri Dec 05 19:31:23 CST 2003

You know, I think I didn't understand the original question until I saw this
response. He wants to select it manually so this appears to be the best
solution.

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FCE392A.1303D309@hydro.com...
> Steve wrote:
>
> > Anyone know how to create a vbscript that will change the
> > user's time zone from a drop-down menu or some other type
> > of input?
>
> Hi
>
> Why not present the builtin menu:
>
> Control.exe TIMEDATE.CPL,,1
>
>
> If you need to do it from