How-to add Keyboard layouts to the language bar.

Imagine the following situation, you are getting new employees from a different country and they need to use a different keyboard layout. As service minded as you are you decide to add the keyboard layouts to the language bar, but what’s the best way to configure this? Well you are using RES Workspace Manager so the answer should be quite straight forward shouldn’t it? Yes I agree it should, but in this case it isn’t, problems like keyboard layouts aren’t added or only get present after the second logon. These are some problems several of our customers are facing when adding keyboard layouts for their users.

In this article I will explain what is causing these issues, give an in depth view of the keyboard settings and give some possible solutions when mandatory profiles are being used.


Where are the keyboard layout settings getting stored?


First thing we need to know is where the settings are stored when a new keyboard layout is added to the language bar.

Windows stores the settings in the registry in the following keys:


  • HKEY_CURRENT_USER\Keyboard Layout\Preload

    Here are the keyboards with their standard layout defined, if you have a closer look at this key you will notice several keys named 1..6 in this example. The value in these keys represents the country and keyboard layout, the key Preload\1 will become the standard keyboard, in this case the value 00000413 represents Dutch (Standard) layout.

  • HKEY_CURRENT_USER\Keyboard Layout\Substitutes

    When a different keyboard layout is needed, Dutch language with US-             International layout for example, the keyboard substitutions are set here.

  • HKEY_CURRENT_USER\Keyboard Layout\Toggle

    Here is the keyboard toggle mode defined, this can have a value between 1..4, these values mean:




Key Sequence for Toggle enabled: LEFT ALT+SHIFT is set (standard value)


Key Sequence for Toggle enabled: CTRL+SHIFT.


Key Sequences disabled.


When default locale is Thai the accent grave key is set for toggle, otherwise it’s disabled.

NOTE: More country layout codes can be found in the following registry keys.

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybCodes
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts


Adding keyboard layouts for different users.


As said in the introduction this should be fairly straightforward when using Workspace Manager, so you create a user registry action for adding the appropriate registry keys into the user profile and even configure a User Setting to save any changes the user makes to the settings.

Then you logon to test these settings and no extra keyboards are added to your language bar. Checking the registry reveals that the keys are properly set, but why aren’t you getting any additional keyboards? The cause for this is not easy to find but it all comes down to a timing issue, the keys set in the HKEY_CURRENT_USER\Keyboard Layout\Preload are only read once in the very early stages of the Windows logon process. The registry keys which are being added by the configured registry action in RES Workspace Manager simply are added to late.

This is causing, regarding the type of user profile you are using, different behavior when adding these keyboard layouts.

Roaming Profile: The keyboard layouts are present at the 2nd logon, the registry keys get added in the first logon but are too late to be read. However they are present in the user profile at the second logon and will be read. In most cases this will not be an issue when users are aware of this.

Mandatory Profile: The keyboard layouts will not be present at all, however the registry keys are getting added. When logging off the profile will get deleted and being build again at logon, registry keys are applied, but are too late to be read. This will create an infinite loop which results into the keyboard layouts not being present.

Local Profile: If the local profile isn’t deleted at logoff then the behavior will be the same as with a roaming profile, when it’s deleted it behaves like a mandatory profile.


How-to get the keyboard layouts added with a mandatory profile.


Now we are at the part where it is getting challenging, how do you get the registry settings applied before Windows reads it? The solution is not to be found with RES Workspace Manager but from the profile itself or Microsoft Active Directory GPO.

There are really two ways which both have their pro’s and cons, these are:

  • Include the keyboard layouts in the mandatory profile so they will be present at logon.

    If it’s not a problem when everybody is getting all keyboard layouts then you could do this, otherwise there’s the option to create several mandatory profiles and distribute them as a custom resource with RES Workspace Manager. This solution is, when the layouts change regularly, quite difficult for the administrator to maintain.

  • Create a GPO and link it to the proper OU, yes it’s that easy but you won’t find the proper GPO settings or an adm(x) file for those setting from Active Directory, Microsoft doesn’t provide one either. So what needs to be done is to create your own adm file in which the proper keyboard layouts will be set and link those to the proper OU’s.

    A small code sample for creating your own custom adm file:



CATEGORY “Keyboard Layout”
POLICY “Keyboard Layout”
KEYNAME “Keyboard Layout\preload”
PART “Dutch (US-International)” CHECKBOX
VALUENAME “1”          ; This will become the default keyboard ;
VALUEON “00000413”
VALUEOFF “00000000”
KEYNAME “Keyboard Layout\Substitutes”
VALUENAME “00000413”      ; Substitute Dutch keyboard layout ;
VALUE “00020409”           ; for US-International ;
KEYNAME “Keyboard Layout\Substitutes”
VALUENAME “00000413”
VALUE “00000000”

PART “Danish (Standard)” CHECKBOX     ; Standard Danish keyboard ;
VALUEON “00000406”
VALUEOFF “00000000”


It will go beyond this article to explain the code, it’s just to give an idea about how a custom adm file can be created, for using this example just copy & paste it into notepad and save it as KbLayout.adm.



  • You will need to adjust the code to your own situation and is not supported by RES Software.
  • The adm code sample is provided as an example, not as a solution.
  • Any changes the user makes in their configuration will be lost because it the policy is set again at every logon, changes saved with User Settings will be ignored.


Some references for creating custom adm files:


Using the keyboard layout adm file within RES Workspace Manager.


Now you have created the adm template for the keyboard layouts it can also be implemented into RES Workspace Manager when you are using roaming or local user profiles.

Add a new policy in RES Workspace Manager 2012 at Composition – Actions By Type – User Registry, now when click the Keyboard Layout node and you can enable the languages you want to add. Combine this with Zones or Workspaces and you can apply the settings easily from RES Workspace Manager, just make sure the first keyboard (set as default) is always selected. You can set this as a run once policy and combine it with zero profiling to store the keyboards.

When a keyboard layout needs to be added, just select the appropriate layout and it’s added at the next logon (will be visible at the second logon however), can’t life be great!


Posted in Tech Tips and tagged , , , , .

Leave a Reply