Configuring the time zone and code page with Group Policy

Configuring the time zone and code page with Group Policy enables the administrator to centrally manage these settings for a multitude of systems.

Change Log
18.01.2019: added the section Redirecting the time zone of the local client in remote sessions.

Table of Contents

 

 

Configuring the time zone using Group Policy

Supported operating systems: Windows 2003/XP and higher, up to and including Windows 10 and Windows Server 2016 (all versions and builds).
Supported deployment methods: all, including direct (bare-metal) installations and image-based deployments using technologies such as Citrix Machine Creation Services (MCS) and Citrix Provisioning Services (PVS).

This section deals with the configuration of the time zone settings. On a local machine, these are configured in the Date & Time settings. Time zone settings are system-specific and not configured per-user (although you can redirect the local time zone in a remote session).

Configuring the time zone and code page with Group Policy - Date and time settings including time zone

The time zone configuration is stored in the Windows registry in the HKEY_LOCAL_MACHINE hive. The exact registry key is:

HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

The time zone settings consist of multiple values as seen in the screenshot below.

Configuring the time zone and code page with Group Policy - Time zone registry settings

To find out the exact value for each of the ten registry entries, first set the time zone manually in the local Date & Time configuration. Afterwards, simply check the aforementioned registry values.

Note: all available time zones are also listed in the registry in the key
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.

Open your Group Policy Management Console (GPMC.msc) and navigate to Computer Configuration \ Preferences \ Windows Settings \ Registry. Since we need to import multiple values, I suggest to use the registry wizard. With a right-mouse click on Registry select New \ Registry Wizard.Now that we have all the information we need, we can set the correct time zone for the local machine. The easiest way to accomplish this is by using a Group Policy Preference registry item. And no, unfortunately there is no native out-of-the-box group policy setting or preference to configure the time zone. This goes for all Windows operating systems.

Configuring the time zone and code page with Group Policy - Group Policy Preference registry wizard

On the first page of the wizard, make sure that Local Computer is selected and click Next. On the second tab, the Registry Browser, navigate to the registry key HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation. Tick the box of each individual registry value (as shown in the image below). Use the scroll bar on the right to go down in the list. Unfortunately, there is no Select All option (@Microsoft: HINT!).

Configuring the time zone and code page with Group Policy - Group Policy Preference registry wizard registry browser

Click Finish. The registry values have been imported.

If you are unhappy with the organisation of the registry items, you can easily move the individual settings (in the blue box) to a new collection item.

Configuring the time zone and code page with Group Policy - Group Policy Preference time zone settings

First, we need to create a new collection item (this is basically a folder). With a right-mouse click on Registry select New \ Collection Item. Enter a name for the collection item, for example TimeZone. Now you can move all individual registry items to this new collection item per drag-and-drop.

Configuring the time zone and code page with Group Policy - Group Policy Preference collection item move items

Afterwards, you can delete the collection item named Registry Wizard Values (all underlying folders are automatically deleted as well).

The registry item is now created and will be deployed to all machines to which the particular Group Policy applies.

Configuring the time zone and code page with Group Policy - Group Policy Preference collection item final

Note: by default, the value name is used as the name of the registry item (as is visible in the image above). It is possible to rename the registry item afterwards, but please be aware that whenever you make changes to the registry item, it’s name will revert back to the value name.

After configuring the time zone, restart the machine to allow the changes to take effect.

Configuring the time zone using PowerShell

Supported operating systems: Windows 7 / Windows Server 2008 R2 and higher, up to and including Windows 10 and Windows Server 2016 (all versions and builds), with PowerShell 5.1 installed (this is a requirement!).

For those of you who want to include the configuration of the time zone in a PowerShell script, the cmdlet Set-TimeZone can be used. The basic command is as follows:

In case the time zone does not exist, an error is returned, which is great when using a try/catch statement. In the example below, I deliberately misspelled the time zone W. Europe Standard Time to force an error:

The Set-TimeZone cmdlet is included in PowerShell 5.1 and, exceptionally, not restricted to the newest operating systems. This cmdlet also works on Windows 7 and Windows Server 2008 R2. PowerShell 5.1 is included in the Windows Management Framework 5.1.

Note: running the Set-TimeZone PowerShell command as a startup script may end in error 5 “access denied”. At least that is what happened when I tested it on a server running Windows Server 2016 version 1607. I do not know why this happened, especially since the group policy is executed by the local system account.

One drawback of using this method (I can’t believe I am about to say something against using PowerShell) is that the time zone will be hard-coded in the image. In case the time zone needs to be changed, you will have to do one (or more) of the following:

  1. Update the master image.
  2. Update each machine to which the master image was deployed. This only applies to direct (bare-metal) installations. In case you use deployment technologies such as Citrix Machine Creation Services (MCS) or Citrix Provisioning Services (PVS), you will have to update the master image and re-deploy it.
  3. Use a Group Policy to change the time zone. This is the most flexible way to manage time zone settings on a multitude of machines.

Configuring the time zone using tzutil.exe

Supported operating systems: Windows 2003/XP and higher, up to and including Windows 10 and Windows Server 2016 (all versions and builds).

Besides the PowerShell cmdlet, Microsoft also offers the on-board utility tzutil.exe to configure the time zone. This tool has been part of the Windows operating system since Windows XP and Server 2003. Here is an example how to set the time zone to Western-Europe Standard Time:

tzutil /s “W. Europe Standard Time”

One drawback of using this method is that the time zone will be hard-coded in the image. Changing the time zone at a later time requires you to do one (or more) of the following:

  1. Update the master image.
  2. Update each machine to which the master image was deployed. This only applies to direct (bare-metal) installations. In case you use deployment technologies such as Citrix Machine Creation Services (MCS) or Citrix Provisioning Services (PVS), you will have to update the master image and re-deploy it.
  3. Use a Group Policy to change the time zone. This is the most flexible way to manage time zone settings on a multitude of machines.

Reference: https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh875624(v=ws.11)

Redirecting the time zone of the local client in remote sessions

In case you have users that connect from a different time zone than the server time zone, in remote sessions, you have the option to redirect the local time zone:

Microsoft Remote Desktop Services

For Remote Desktop Sessions, you can enable a Microsoft group policy that redirects the time zone of the local client. You can find this policy here:

Computer Configuration \ Administrative Templates \ Windows Components \ Remote Desktop Services \ Remote Desktop Session Host \ Device and Resource Redirection -> Allow time zone redirection

Configuring the time zone and code page with Group Policy - Group policy redirect time zone

Citrix Virtual Apps and Desktops (CVAD) / XenDesktop

For Citrix (ICA) sessions you can configure the policy Use local time of client to redirect the local time zone to the remote server.

Configuring the time zone and code page with Group Policy - CVAD use local time of client

Configuring the code page using Group Policy

Supported operating systems: Windows 2003/XP and higher, up to and including Windows 10 and Windows Server 2016 (all versions and builds).
Supported deployment methods: all, including direct (bare-metal) installations and image-based deployments using technologies such as Citrix Machine Creation Services (MCS) and Citrix Provisioning Services (PVS).

 

 

This section deals with the configuration of the code page (system locale) of the local system. The code page controls the language the system uses for non-unicode programs. On a local machine, the code page is configured on the third tab, Administrative, of the Regional Settings Control Panel item. The code page is system-specific (not configured per-user).

Configuring the time zone and code page with Group Policy - Regional Settings Administrative tab system locale

Note: in Windows, the code page is referred to as system locale. I am not in agreement with this, because the system locale also includes other components such as the display language (the Windows language) and the default input language (the keyboard layout) for the system user. These settings determine what a user sees at the Windows logon window (CTRL+ALT+DEL). In therefore in this article use the word code page and not system locale.

The code page setting is stored in the Windows registry in the HKEY_LOCAL_MACHINE hive. The exact registry key and value are:

HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language -> Default (REG_SZ)

Configuring the time zone and code page with Group Policy - Registry setting system locale

Please be aware that the value Default is not the same as the (Default) value present in every registry key. The code page is stored in the value Default, so this one:

Configuring the time zone and code page with Group Policy - Registry setting system locale short

Not this one:

Configuring the time zone and code page with Group Policy - Registry setting system locale wrong default short

To determine the country ID, change the code page manually on your local system. On the local system, open the Regional Settings in the Control Panel. The code page (system locale) can be changed on the third tab. After changing the code page, you will be asked to reboot the system. This is not necessary. The registry value Default containing the code page setting has already been modified. Go to the registry and check your country ID.

For example, when I set the code page to German (Austria), the value Default is set to 0c07. Before it was 0409, which is the country ID for the United States.

Now that we have all the information we need we can set the correct code page for the local machine. The easiest way to accomplish this is by using a Group Policy Preference registry item.

Open your Group Policy Management Console (GPMC.msc) and navigate to Computer Configuration \ Preferences \ Windows Settings \ Registry. With a right-mouse click on Registry select New \ Registry Item. Configure the registry item as follows:

  • Action: replace
  • Hive: HKEY_LOCAL_MACHINE
  • Key path: SYSTEM\CurrentControlSet\Control\Nls\Language
  • Value name: Default
  • Data type: REG_SZ (= string)
  • Value data: <your value>, e.g. 0c07 or 0409

Configuring the time zone and code page with Group Policy - Group Policy Preference registry item codepage

The registry item is now created and will be deployed to all machines to which the particular Group Policy applies.

Note: by default, the value name is used as the name of the registry item (as is visible in the image above). It is possible to rename the registry item afterwards, but please be aware that whenever you make changes to the registry item, it’s name will revert back to the value name.

After configuring the code page, restart the machine to allow the changes to take effect.

30 thoughts on “Configuring the time zone and code page with Group Policy

  1. Pingback: Citrix Receiver unattended installation with PowerShell - Dennis Span

  2. Pingback: Configuring Regional Settings and Windows locales with Group Policy - Dennis Span

  3. Thanks for sharing this great article! Very helpful.
    However what happens on daylight saving times? Will it not create issues when I force the reg keys by GPP?

    • Hi Thomas, thanks for the kind feedback. Daylight saving time is simply one of the time zone settings you can configure using GPP. It can either be enabled or disabled (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation -> DisableAutoDaylightTimeSet -> DWORD -> 1). Are there any specific issues you are worried about?

  4. Hi Dennis,

    I was just concerned because ActiveTimeBias was changing automatically when I have tried to manually change the date to a summer time date for testing. Do you know what this value is being used for? I was thinking it could be something that windows tries to update dynamically so something to better not override by GPP.

    • Hi Thomas,

      I never had any problems with configuring these registry values. What you can always do is to configure the GPP option “apply only once”. This of course only works on persistent machines.

  5. Pingback: How to Change Date and Time in a Citrix Session - Concluzion.com

  6. Pingback: Building Hybrid Cloud on Nutanix CE – Part IV - xenappblog

  7. Dear Dennis,
    i am facing a problem.
    i can’t install visual foxpro 9 because it’s asking me to insert to correct disk while i installed the right disk.
    i have application executable written in visual foxpro 9 and the data are in arabic, so i put the system locale set to arabic but i that time the vfp9 executalble won’t work even the foxpro 9 is not working since i didn’t install it correctly.
    can you help me please how to solve this problem.

    thank you
    kamal

  8. Hi Dennis,
    I am creating our own image for our clients, we should use UTC as TimeZone, I did all the steps you mentioned above, created registry and changed “TimeZoneKeyName” from Central Europe Standard Time to “UTC”.

    however if I login into my clients, its still shows Central Europe Time.

    any idea why?

  9. You can copy out the folder that contains all of the keys to the root of Registry, and simply rename.

    Great article otherwise!

  10. Pingback: Building a Hybrid Cloud on Nutanix Community Edition - xenappblog

  11. Sir, I am from Bhutan. Bhutan is not there in World Time Zone. I came to know that by writing Script we can add he New Time Zone in World Time Zone in Windows 10. Up to Windows XP I used Time Zone Editor to Change the Time Zone to Bhutan but after Window XP the TZE stops Working. Therefore, I request your good self to write an script for me for to add Bhutan / Thimphu Standard Time in World Time Zone in Window 10.

  12. Hello,

    I applied the GPP for Japanese as 0411 and it changed the registry value, however the GUI non-unicode language still display as English after reboot. Which language system will consider?

    Thank you

    • Hi, I just tested this, using the value 0411 (Japanese) in the value name Default in the registry key HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language on a Windows 11 machine and this worked fine. After rebooting the machine, Windows showed Japanese as the “current language for non-Unicode programs” (intl.cpl).

  13. You solved the problem I had in my domain with different computers on different time-zones (I used your Group Policy solution) – thank you so so much!

Leave a Reply

Your email address will not be published. Required fields are marked *

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