Iโ€™ve spent a lot of time talking about time, time zones, with multiple blogs (part 1 and part 2) talking about available options.  One of the options that I mentioned in the first blog was to let Windows 10 set the time zone automatically.  But thatโ€™s a little tricky, as there are some dependencies:

  • Location services needs to be enabled in Windows 10.  If youโ€™ve configured Windows Autopilot to skip the privacy settings page in OOBE, it will be off by default.
  • The user signing in the first time needs to have administrator rights.  (Itโ€™s still not clear why thatโ€™s the case.)
  • Windows needs to be able to find the devices location reasonably accurately โ€“ typically thatโ€™s done through the IP address info, not too bad when youโ€™re at home, but it can be more problematic when on a corporate network.

So you can still use the โ€œmanually set itโ€ options that I described in the blog, but to make it easier for the โ€œautomatically set itโ€ Windows behavior, I added additional logic to the Autopilot Branding package on GitHub.  If you configure that to not specify a specific time zone, it will by default fall back to enabling location services to set the time.

image

Feel free to try it out.  (Itโ€™s actually hard for me to try it because the default time zone is Pacific and my location is Pacific, so all I can confirm is that location services is indeed enabled.)


Discover more from Out of Office Hours

Subscribe to get the latest posts sent to your email.

3 responses to “Time, time, time (and location services)”

  1. Koen Van den Broeck Avatar
    Koen Van den Broeck

    Hi,
    I finally ended up adding a few lines of code in the Autobranding script you wrote. It is not always ideal in a corporate network, but surprisingly it works fine in our environment.

    For those who want to give this a go: (just use your own Bing Key ๐Ÿ˜‰

    # STEP 3: Set time zone (if specified)
    #if ($config.Config.TimeZone) {
    # Write-Host “Setting time zone: $($config.Config.TimeZone)”
    # Set-Timezone -Id $config.Config.TimeZone
    #}
    $BingKey =
    $IPInfo = Invoke-RestMethod http://ipinfo.io/json
    $Location = $IPInfo.loc
    Write-Host “Country : “$IPInfo.country
    Write-Host “Public IP Address : “$IPInfo.ip
    Write-Host “Location : “$IPInfo.loc
    $BingTimeZoneURL = “http://dev.virtualearth.net/REST/v1/TimeZone/$Location” + “?key=$BingKey”
    $ResultTZ = Invoke-RestMethod $BingTimeZoneURL
    $WindowsTZ = $ResultTZ.resourceSets.resources.timeZone.windowsTimeZoneId
    If (![string]::IsNullOrEmpty($WindowsTZ))
    {
    Get-TimeZone -Name $WindowsTZ
    Set-TimeZone -Name $WindowsTZ
    }

    ###
    Have fun
    Koen

    Like

    1. Hey Koen,
      I tried your script and it looks to be working fine.
      I didn’t had success with the the other solutions until now.
      We use Intune and Autopilot all over the globe in many different timezone and this is a great help so far.
      Thanks a lot
      Matthias

      Like

      1. Koen Van den Broeck Avatar
        Koen Van den Broeck

        Hi Matthias, Happy to hear it helped you
        Thx for the feedback
        Koen

        Like

Trending