Set TimeZone on Computers with Microsoft Intune and Graph API

In this Microsoft Intune and Graph API post, we will show how to Set TimeZone on computers with Microsoft Intune and Graph API.

Microsoft Graph API is a unified API that provides access to almost any Microsoft 365 service, including Microsoft Intune.

We can programmatically deploy any available policy in Microsoft Intune using the API and assign Entra ID users to it.

This post will focus on creating a custom configuration profile that will set the timezone on Windows machines using API.

Set TimeZone on Computers with Microsoft Intune and Graph API

To use Graph API, we must first create an App Registration with the appropriate permissions. Please use the following posts to create an App Registration and set up your Postman client.

In the following POST API request, I will create a Windows 10X Configuration policy with a custom template.

The request’s body contains a JSON file with the Timezone configuration in the form of an OMA setting.

In case you are not familiar with OMA. Intune OMA (Open Mobile Alliance) settings refer to device management configurations within Microsoft Intune that utilize the OMA Device Management (DM) protocol.

Postman POST Request

The following POST request will use the Microsoft Graph API, the device management resource.

https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations

You can see the POST request in the following screenshot

Request Body (JSON)

The JSON request body contains all the details about the request and is shown below.

{
  "@odata.type": "#microsoft.graph.windows10CustomConfiguration",
  "displayName": "Configure timezone",
  "name": "Timezone",
  "omaSettings":[
    {
        "@odata.type": "#microsoft.graph.omaSettingString",
        "displayName": "ConfigureTimeZone",
        "description": "Set timezone",
        "omaUri": "./Device/Vendor/MSFT/Policy/Config/TimeLanguageSettings/ConfigureTimeZone",
        "value": "AUS Eastern Standard Time"
    }
  ]
}

The screenshot below shows the Request and JSON body in Postman.

To apply the policy, click on Send in Postman. In the screenshot below, you can see the end result.

If you would like to see the OMA settings for the ConfigureTimeZone property, visit this page https://learn.microsoft.com/en-gb/windows/client-management/mdm/policy-csp-TimeLanguageSettings?WT.mc_id=Portal-Microsoft_Intune_Workflows#configuretimezone

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.