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).
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.
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.
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!).
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.
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.
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.
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:
1 |
Set-TimeZone -Id "W. Europe Standard Time" |
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:
1 2 3 4 5 6 7 |
[string]$TimeZone = "W. Europe Standard Timeeeeeeee" try { Set-TimeZone -Id $TimeZone Write-Host "Success: the time zone $TimeZone has been set" } Catch { Write-Host "Error: the time zone $TimeZone does not exist!" } |
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:
- Update the master image.
- 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.
- 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:
- Update the master image.
- 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.
- 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.
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
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 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).
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)
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:
Not this one:
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
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.
Dennis Span works as a Lead Account Technology Strategist at Cloud Software Group in Vienna, Austria. He holds multiple Citrix certifications (CCE-V). Dennis has been a Citrix Technology Advocate (CTA) since 2017 (+ one year as Citrix Technology Professional, CTP). Besides his interest in virtualization technologies and blogging, he loves spending time with his family as well as snowboarding, playing basketball and rowing. He is fluent in Dutch, English, German and Slovak and speaks some Spanish.
Thanks a lot. This works and helped me a lot.
You’re welcome Dariusz. Happy to have been of help!
Pingback: Citrix Receiver unattended installation with PowerShell - Dennis Span
Pingback: Configuring Regional Settings and Windows locales with Group Policy - Dennis Span
GREAT write up! Very detailed! Thank you for this info!
My pleasure Jon. And thank you for your very kind feedback!
Dude, thanks so much! Really helped me out!
You are very welcome Bruce! And thank you for taking the time to write me this great feedback!
Thank you, very helpful article – this registry wizard rocks 🙂
Glad to have been of help!
Thank you for the detailed explanations for the different settings in an understandable format.
You are welcome Alwin! And thank you for your kind feedback!
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?
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.
Pingback: How to Change Date and Time in a Citrix Session - Concluzion.com
Pingback: Building Hybrid Cloud on Nutanix CE – Part IV - xenappblog
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
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?
Hi Dogu,
Two things come to mind. First of all, the time zone from the local client can be redirection in a remote session (https://dennisspan.com/configuring-the-time-zone-and-code-page-with-group-policy/#RedirectTimeZone). Secondly, the way that the date and time are displayed to the user depends on the user specific regional settings (https://dennisspan.com/configuring-regional-settings-and-windows-locales-with-group-policy/).
You can copy out the folder that contains all of the keys to the root of Registry, and simply rename.
Great article otherwise!
Pingback: Building a Hybrid Cloud on Nutanix Community Edition - xenappblog
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.
Hi Dilli,
Apologies for the late reply. I just checked the Microsoft website and Bhutan seems to be part of the Bangladesh time zone (https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones). You simply need to use the time zone “Bangladesh Standard Time” in your scripts. I live in Austria and there is no Austrian time zone either. I have to use “W. Europe Standard Time”. I hope this answers your question.
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).
Itwas very helpful thanks !!!!!!!!!
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!
Happy to have been of help!