Change keyboard layout for Boot Images in ConfigMgr with PowerShell

While developing the ConfigMgr OSD FrontEnd, a good chunk of customers where I’ve helped them to implement the solution, has asked me to also change keyboard layout (input locale) for their boot images as well. The reason for this is quite simple, technicians or end users that are supposed to use the frontend should not be required to be familiar with the default keyboard layout of en-US. Generally, there’s no need to change this if you’re a shop that do zero-touch deployments, but whenever you introduce a frontend of some kind, and require the user to input data it’s convenient if the keyboard layout is set to what the user  expects.

Making this kind of change to the boot image (in fact the Windows PE image) is not a complex task to be honest. In fact, it’s a simple operation of mounting the boot image wim file, running a command line with DISM.exe and then dismount and commit the changes. But instead of providing you with a solution that consists of running a set of command lines (see this post for a great example of just that), I’ve created a simple PowerShell script that takes the PackageID of a boot image, the keyboard layouts you want to set (it supports an string array of multiple layouts) and the mount path as parameter inputs wrapping it all into a single script. It also provides the capability to update the package source meaning that it refreshes the boot image on the Distribution Points.

However, it’s recommended to utilize a version of DISM.exe that supports managing the boot image in question. Simply running the command lines from the post referenced above on a Windows Server 2012 R2 machine, will not be sufficient for this type of operation, due to the version of DISM.exe available in the operating system does not support newer Windows PE images (from Windows ADK 10 and above). To over come this, this script has been built so that it detects the installation path of Windows ADK

So just to clarify, this script is required to run on a machine (with access to the boot image package source) that has a supported version of Windows ADK installed, in order to service the boot image. Preferably, this operation should be executed on the Primary Site server, if it meets the requirements just mentioned.

If you want to dig into the documentation for changing the keyboard layout, have a look at the following link under /Set-InputLocale:

Download the script

You can grab this script from the repository on GitHub:

Using the script

As with any other of our scripts, it’s built so that it can be executed directly from a PowerShell console, just like running a cmdlet.

Picture this scenario, you are running ConfigMgr Current Branch (any version currently in support by Microsoft) with Windows ADK version 1709 installed on the Primary Site server. You have a boot image updated to image version 16299 (which is the build number for Windows ADK version 1709). You want to set the keyboard layout for a specific boot image to Swedish and English. Before changing the keyboard layout for that boot image, you need to locate the PackageID (also referred to as ImageID for boot images). In the ConfigMgr console under Software Library – Operating Systems – Boot Images make a note of the ImageID property:

As seen in the image above, for this scenario we’ll be using P0100095. With this information, we can now go ahead execute the script to change the keyboard layout for this boot image.

Run the following command line, and adjust it for your environment:

.\Set-CMBootImageInputLocale.ps1 -SiteServer "CM01" -PackageID "P0100095" -Locale "sv-se", "en-us" -MountPath "C:\Temp\Mount" -UpdatePackage -Verbose

When executing the above command line, the boot image will be backed up to its existing package source location. After that the image will be mounted to the specified mount path. This path needs to be an empty folder somewhere locally on the machine where the script is executed. Once mounted, it will attempt to change the keyboard layout and if successful in changing that, it will dismount the boot image from the mount path and commit the changes. The above command line also specified the UpdatePackage parameter switch, providing this in the command line will refresh the boot image on the Distribution Points it’s distributed to. This operation will take some time, which is also mentioned in the verbose logging, so don’t close the console if it appears that the script has stopped.

Below is the complete output from the script when it’s running the command line specified above:

That’s it, quite simple enough to update the keyboard layout of any boot image right?

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.


  • Hi,

    Good script 😉
    A little bug when you use it only with one language
    Just change in line 189 $Locales = $Locale -join “;” >> $Locale = $Locale -join “;”
    and in line 194 /Set-InputLocale:$($Locales)” >> /Set-InputLocale:$($Locale)”

    Have fun 😉


Categories use cookies to ensure that we give you the best experience on our website.