Share via


How to set the timezone based upon the client's location

Question

Wednesday, July 1, 2015 9:09 PM

Hi,

We have offices in several regions and I'd like for our client computers to have the correct timezone when the OSD process has completed. They way it is working now involves a tech setting the timezone manually after the deployment is done. I have been using SMSDP as a reference for the client computer to determine the location where it's being imaged. I have tried using a Task Sequence Variable named TimeZone set to the value of the country - no help. I also tried using a Task Sequence Variable name OSDTimeZone but this resulted in halting the imaging process and displaying a dialog box for setting the timezone manually. Pausing the OSD process is definitely not how I would like to do this.

What is the best approach to getting the timezone set properly so it's one less thing to do post deployment?

Thanks,

Rob

All replies (12)

Thursday, July 2, 2015 4:17 PM ✅Answered | 1 vote

We are talking about active directory site and not domain. If your domain is in a single site but as multiple time zone you are doing something weird :)

If you want something simple other than Jeff suggestion you could simple get a PowerShell script that change the timezone.

The PS script could look for what ever you need either a AD site or something else and use this command to set the time zone  tzutil.exe /s "time zone name" you set this script to run in your TS near the end and voila.

Torsten: Thw WMI query was setup up by the people before me after looking at it carefully they have setup in the unattended file a variable  %OSDTimeZone% and in the huge powershell scrip that change and gather info they set this. SO this is why i was under the impression it was working did a test and disable the old step and came to the conclusion it was never working.

Thanks for pointing that out.


Thursday, July 23, 2015 11:13 PM ✅Answered

Here is the solution that I came up with a structure similar to that shown below in my task sequence:

Group - Configure Timezone (no conditions)
    Group - Pacific - (run if SMSDP = pacific region)
        Run Command Line - Set Pacific time - uses command (cmd /c tzutil.exe /s "Pacific Standard Time")
    Group - Eastern - (run if SMSDP = eastern region)
        Run Command Line - Set Eastern time - uses command (cmd /c tzutil.exe /s "Eastern Standard Time")
    Group - London - (run if SMSDP = London region)
        Run Command Line - Set London time - uses command (cmd /c tzutil.exe /s "GMT Standard Time")

  .  .  .

Each of our offices has its own Distribution Point which is really useful in determining where the client is located when it is imaged.

During testing, I have found this approach to be reliable for setting the timezone for the region where the client is being imaged. I went a step further by looking at SMSDP and then set the region in the registry for later inspection. For example, this solution also needed a way to connect the client computer to the network printer queues in its local office. Since printer connections are per user, I need to refer to the location setting I wrote into the registry for each new user login. This tells me the region the computer belongs in and then connect the client to the correct printer queue.

Thanks to everyone that helped out with this!


Thursday, July 2, 2015 12:10 AM

Do you have ConfigMgr integrated with MDT? If so, you can use the customsettings.ini and DefaultGateway to set the time zone differently based on location.

https://anothermike2.wordpress.com/2012/04/21/back-to-basic-customsettings-ini-explained/

Jeff


Thursday, July 2, 2015 1:03 PM

Well the easy way would be doing it via WMI query of your client. 

Select * from Win32_NTDomain WHERE ClientSiteName LIKE "%ADSiteName%"

Using this task sequence task Apply Windows Settings you can set multiple one for all your time zone base on the WMI query result.

Or if you prefer something more in the line of a scrip you can look here:http://blogs.technet.com/b/eugenev/archive/2012/12/28/task-sequence-time-zone-fun.aspx

Hope this help


Thursday, July 2, 2015 1:52 PM

Select * from Win32_NTDomain WHERE ClientSiteName LIKE "%ADSiteName%"

Using this task sequence task Apply Windows Settings you can set multiple one for all your time zone base on the WMI query result.

Have you actually tried if that is working? That task must be running in Windows PE so I wonder if win32_ntdomain does return useful data at all at that point of time. 

Torsten Meringer | http://www.mssccmfaq.de


Thursday, July 2, 2015 2:20 PM

Well here we running the apply windows setting after the computer is join to the domain. 

So right before that step we are running a PS scrip that gather lot of info for the apply windows settings.

So was under the impression you could just do the simple WMI query and it would give you the info you want as long as you have the right order in the TS.

 


Thursday, July 2, 2015 2:53 PM

Well here we running the apply windows setting after the computer is join to the domain. 

 

That should result in nothing happening at all then. All that step does is modifying / patching the unattend.xml (which is useless when a computer is joined to the domain, because it must be already running in the full OS then). Or are you talking about the "Apply network settings" (which also just touches unattend.xml)?

Torsten Meringer | http://www.mssccmfaq.de


Thursday, July 2, 2015 3:13 PM

Hi Jeff,

Your suggestion may be the only approach that works from what I have been finding. Do you know if one customsettings.ini can decide the right timezone for seven different regions or will it require one file for each region?

-Rob


Thursday, July 2, 2015 3:14 PM

Hi Frederick,

This is a good suggestion but all of our offices are on the same domain. Each site has its own domain controllers though which is another approach I have been considering.

-Rob


Thursday, July 2, 2015 3:58 PM

Single customsettings.ini with multiple default gateways defined based on your locations.  Check out the link I posted originally, if you have not done so already.

Jeff


Thursday, July 2, 2015 4:34 PM

Ok, that makes sense. This would work with the exception of two regions in different timezones are lumped in one OU and I doubt that anyone would entertain splitting them out. All of the other regions are in their own OU. And I agree, there is some weirdness to our config but I have no say in the matter so I have to work with what I have today, unfortunately.

The script that you called out might work with a few tweaks. The customsettings.ini might work too.


Thursday, July 2, 2015 5:24 PM

Again OU and active directory site are 2 different things.

Subnets are what set active directory sets apart. Normally you try to keep thing close together so using site should work. But if you go with the PS script you can look at anything to decide what time zone they are in.