Automatically Set the Time Zone in Intune Autopilot
- Florian Salzmann
- Posted on 27 Aug, 2025
- Updated on 18 Nov, 2025
- 03 Mins read
- Microsoft Intune,PowerShell,Windows 10,Windows 11
When I first saw Peter Klapwijk’s solution, I was impressed. It used an IP lookup via a URL and an Azure Maps Account to detect the correct time zone during Autopilot enrollment.
I have used it primarly in Europe, with great success.
This week, I implemented it for a US-based customer. That’s when I noticed a challenge:
For countries with multiple time zones, Azure Maps returns several results, making it unclear which one to apply.
I started looking for an alternative and discovered that the IPInfo API provides a single, precise time zone value using their legacy free API.
The best part?
No Azure Maps account is needed.
This makes the setup easier, faster, and without extra services.
The legacy free API from IPInfo could be deprecated in the future, but at the time of writing, there is no end-of-life date.
How it works
The script queries the IPInfo API, retrieves the IANA time zone, and converts it into the Windows time zone format using the official Microsoft mapping XML.
It then applies the time zone directly on the device.
This approach is perfect for Autopilot scenarios, where devices are enrolled in Intune without user interaction.
Get the script
Download my ready-to-use script from GitHub:
It’s a single PowerShell file with no dependencies apart from the Windows OS itself.
How it works
The script:
- Calls
http://ipinfo.io/jsonto get the device’s IANA time zone - Downloads the Microsoft
windowsZones.xmlmapping - Converts the IANA time zone into the Windows time zone format
- Applies the time zone using
Set-TimeZone
Example output during execution:
.\Set-TimeZoneByIPAddress.ps1
Fetching IANA time zone from ipinfo.io...
Detected IANA Time Zone: Europe/Zurich
Downloading custom XML mapping...
Searching for matching mapping...
Mapped to Windows Time Zone: W. Europe Standard Time
Setting Windows time zone using Set-TimeZone...
Successfully set Windows Time Zone: W. Europe Standard Time
This approach is perfect for Autopilot scenarios, where devices are enrolled in Intune without user interaction.
How to deploy via Intune
Option 1: Deploy as a platform script
- Go to Devices → Scripts in the Intune Admin Center
- Create a new Windows PowerShell script
- Upload the
Set-TimeZoneByIPAddress.ps1file - Set Run this script using the logged-on credentials to No
- Set Run script in 64-bit PowerShell to Yes
- Assign the script to your Autopilot device group
This method is fast to set up and works well if you just need to run the script once during enrollment.
Option 2: Deploy as a Win32 app
For more flexibility and better logging, you can package the script as a Win32 app.
First add this at the bottom to the first script (we will use it as the detectionlater)
$Path = "HKLM:\SOFTWARE\scloud\Set-TimeZoneByIPAddress"
$Key = "Version"
$KeyFormat = "dword"
$Value = "1"
if(!(Test-Path $Path)){New-Item -Path $Path -Force}
if(!$Key){Set-Item -Path $Path -Value $Value
}else{Set-ItemProperty -Path $Path -Name $Key -Value $Value -Type $KeyFormat}
- Create a folder with your
.ps1file and an install command - Use the Microsoft Win32 Content Prep Tool to convert it to
.intunewin - In the Intune Admin Center, create a new Windows app (Win32)
- Upload your
.intunewinpackage - Use this install command:
%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -command .\Set-TimeZoneByIPAddress.ps1 - And this uninstall command:
reg delete "HKLM\SOFTWARE\scloud\Set-TimeZoneByIPAddress" /f - Detection rule:
- HKEY_LOCAL_MACHINE\SOFTWARE\scloud\Set-TimeZoneByIPAddress
- Version
- Equals 1
- Assign it to your Autopilot device group
This method gives you greater control over reruns, detection logic and versioning, and makes it mandatory in Autopilot (v1). However, this only applies to Autopilot and not to Autopilot Device Preparation (Autopilot v2). With Device Preparation, you have greater control over script execution and can choose to run this platform script before the user logs in.
Why this is better for multi-time-zone countries
Unlike Azure Maps, which might return multiple possible zones for a country, IPInfo provides a single, accurate match for the device’s location.
This is especially valuable in the US, Canada, Australia, and other large countries with multiple zones.
Conclusion
With this new script, setting the correct time zone in Intune Autopilot becomes much simpler.
No Azure Maps account, no ambiguity for multi-zone countries, and no extra services to maintain.
You can implement it in minutes and ensure your devices always start with the correct time.
