Especially in larger international organizations, it often becomes necessary to manage the languages your users have access to via their keyboards. PowerShell allows you to automate this task.

Bryce McDonald

Bryce is an expert systems engineer with the majority of his experience in Powershell, automation, DevOps, and cloud infrastructure. He is based in Kansas City and you can reach him on twitter @_brycemcdonald or on his blog brycematthew.net.

Adding languages ^

It's simple to look at the language list, as PowerShell has a built-in cmdlet for this.

When we view the contents of $LanguageList, we'll see the object returned. And if US English is your only chosen keyboard language, your output should look like the following:

Creating a LanguageList object

Creating a LanguageList object

If we want to add a language, we can use an easy method to accomplish this task. All we need to do is apply the Add method to our $LanguageList object to add the locale of the keyboard language we want to use. For instance, if we want to add Lithuanian to the keyboard list, we'd add lt-LT first to our object

If we now view the contents of this, it should look like the following:

Assuming we're ready to set the language list to include Lithuanian, all we have to do now is run the cmdlet below:

Adding Lithuanian to LanguageList

Adding Lithuanian to LanguageList

Removing languages with indexes ^

Unfortunately, we can't simply remove the lt-LT language from our language list with PowerShell. In fact, trying to remove it will return a False from PowerShell.

This is because the $LanguageList object we created from our Get-WinUserLanguageList cmdlet doesn't actually contain strings, and it is not an array. It's an object of the type List<WinUserLanguage>.

What we can do, however, is call the index position of our $LanguageList object to choose which language we want to remove. By inspecting our $LanguageList object, we can look at the second index position to find the Lithuanian keyboard language.

Trying to remove It LT language from the language list

Trying to remove It LT language from the language list

When we combine that with the Remove method, we're able to strip the Lithuanian keyboard from our $LanguageList object. This is because the method is expecting us to use a WinUserLanguage object. By simply calling the string "lt-LT" through the Remove method, it is not passing enough information to our $LanguageList object. The WinUserLanguage object is full of information like BCP-47, Autonym, English Name, Localized Name, Script, Input Methods, and Handwriting Recognition (we can see all of this by piping our $LanguageList object to Get-Member).

Moving forward though, let's remove the second language in our language list by referring to it in the Remove method by way of array notation (keeping in mind that "Position 2" in an array is actually "1").

And when we look at our object one last time, we will see it only lists English. Once we have a list of languages we're happy with, just like before, we can use our Set-LanguageList cmdlet to set the keyboards available to us.

Adding Lithuanian to LanguageList

Adding Lithuanian to LanguageList

Removing languages by locale ^

The other option we have, other than knowing the index of the language we want to remove, is to add some logic that allows us to search with our locale string. For this, we have to use the searching capabilities of Where-Object in our Remove method to find the locale string within the LanguageTag property of our $LanguageList object.

This will return True, and we follow it up again with our Set command:

Removing Lithuanian with index notation

Removing Lithuanian with index notation

This is a more deployable command, in case your environment allows your users to customize which keyboards they have access to. Using this Remove method will let you avoid accidentally removing a language your user wishes to have by incorrectly referencing it with the array notation.

And there you have it! From the two ways I showed you, you now know how to add and remove keyboard languages for Windows users.

Join the 4sysops PowerShell group!

2+

Users who have LIKED this post:

  • avatar
  • avatar
Share

Related Posts

5 Comments
  1. Milada 4 months ago

    Hello Bryce,

    I am glad I found your article as it seems I finally found a hope to my annoying problem.

    I have installed the Windows 10 1803 version update, but still after reading your article, I continue to still have an issue this time concerning PowerShell:

    However, I do not know how to open PowerShell so that the command concerns DIRECTLY the PC´s C main disk, like in your case:

    C:\>

    but in my case I only have "administrator" and "ISE administrator" and "Windows ISE":

    PS C:\Users\...>

    or

    PS C:\WINDOWS\system32>

    Does this mean that "my" PowerShell does not allow the use of "C:\>" command?

    The only idea I have is to solve it via Registry - over the "regedit" command? Do you think so?

    Thank you first of all to you Bryce but I will be very happy if I receive any reply from anyone else reading this post, as it would help me further out.

    Kind regards,

    Milada

    1+

    Users who have LIKED this comment:

    • avatar
    • Author
      Bryce McDonald 4 months ago

      Hi Milada,

      In your case, you only need to open PowerShell.  For simplicity in the article, I put the PowerShell prompt as "C:\" (which you *can* get to by typing the command below:

      But this will work regardless of your location on the computer.  You could be in C:\Users\<username>\Desktop or you could be in C:\windows\system32 and it would all work.

      Thanks!
      -Bryce

      1+

  2. Milada 4 months ago

    Hi Bryce,

    thank you for replying so soon.

    Here is what I got:

    cd C:\
    PS C:\> Get-WinUserLanguageList

    LanguageTag : sr-Latn-RS
    Autonym : srpski (Srbija)
    EnglishName : Serbian
    LocalizedName : Srbština (latinka, Srbsko)
    ScriptName : Latinka
    InputMethodTips : {241A:0000081A}
    Spellchecking : True
    Handwriting : False

    LanguageTag : cs
    Autonym : čeština
    EnglishName : Czech
    LocalizedName : Čeština
    ScriptName : Latinka
    InputMethodTips : {0405:00000405}
    Spellchecking : True
    Handwriting : False

    LanguageTag : de-DE
    Autonym : Deutsch (Deutschland)
    EnglishName : German
    LocalizedName : Němčina (Německo)
    ScriptName : Latinka
    InputMethodTips : {0407:00000407}
    Spellchecking : True
    Handwriting : False

    LanguageTag : it-IT
    Autonym : italiano (Italia)
    EnglishName : Italian
    LocalizedName : Italština (Itálie)
    ScriptName : Latinka
    InputMethodTips : {0410:00000410}
    Spellchecking : True
    Handwriting : False

    LanguageTag : fr-FR
    Autonym : français (France)
    EnglishName : French
    LocalizedName : Francouzština (Francie)
    ScriptName : Latinka
    InputMethodTips : {040C:0000040C}
    Spellchecking : True
    Handwriting : False

    LanguageTag : en-GB
    Autonym : English (United Kingdom)
    EnglishName : English
    LocalizedName : Angličtina (Spojené království)
    ScriptName : Latinka
    InputMethodTips : {0809:00000809}
    Spellchecking : True
    Handwriting : False

    LanguageTag : ru
    Autonym : русский
    EnglishName : Russian
    LocalizedName : Ruština
    ScriptName : Cyrilice
    InputMethodTips : {0419:00000419}
    Spellchecking : True
    Handwriting : False

    PS C:\> $LanguageList.Remove(($LanguageList | Where-Object LanguageTag -like sr_Latn-RS))
    You cannot call a method on a null-valued expression.
    At line:1 char:1
    + $LanguageList.Remove(($LanguageList | Where-Object LanguageTag -like ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    PS C:\>

    I would like to give you some further background information with the hope that they would be useful to you in order to solve this "mysterious" issue 🙂

    Outcome of PowerShell code to remove language in Windows10

    I look forward to your reply,

    Milada

    0

  3. uccoffee 4 months ago

    Hi , is there anyway to add a InputMethodTip via powershell?  I would like to add 0C04:E03D0C04

    Since the windows 10 1809 removed the access of old control panel language, I cannot change or add or remove this IME anymore.

    Many thanks

    1+

  4. Milada 2 months ago

    Hi Bryce,

    it´s been a month that you replied last to my request.

    Do you have any news?

    My current problem is this:  I have 4 Windows display languages, apart from Czech! but there is a US EN, but the GB EN is under Add Language

    How do I remove US-EN as a default language and put Czech instead?

    I think the problem could be solved by using the registry. I have some shots, but I do not know, how to attach them in this message box.

    Thank you,

    Milada

     

    0

Leave a reply

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

*

CONTACT US

Please ask IT administration questions in the forum. Any other messages are welcome.

Sending
© 4sysops 2006 - 2019

Log in with your credentials

or    

Forgot your details?

Create Account