Windows Autopilot

Time, time, time (and location services)

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

Categories: Windows Autopilot

3 replies »

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

    • 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