- Add IAM users and groups to AWS with PowerShell - Thu, Jul 12 2018
- Read nested Active Directory groups in PowerShell - Fri, Jun 29 2018
- Configuring CloudWatch with PowerShell - Mon, Jun 18 2018
Adding languages
It's simple to look at the language list, as PowerShell has a built-in cmdlet for this.
$LanguageList = Get-WinUserLanguageList
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:
PS> $LanguageList LanguageTag : en-US Autonym : English (United States) EnglishName : English LocalizedName : English (United States) ScriptName : Latin script InputMethodTips : {0409:00000409} Spellchecking : True Handwriting : False
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
$LanguageList.Add("lt-LT")
If we now view the contents of this, it should look like the following:
PS> $LanguageList LanguageTag : en-US Autonym : English (United States) EnglishName : English LocalizedName : English (United States) ScriptName : Latin script InputMethodTips : {0409:00000409} Spellchecking : True Handwriting : False LanguageTag : lt-LT Autonym : lietuvių EnglishName : Lithuanian LocalizedName : Lithuanian ScriptName : Latin script InputMethodTips : {0427:00010427} Spellchecking : True Handwriting : False
Assuming we're ready to set the language list to include Lithuanian, all we have to do now is run the cmdlet below:
Set-WinUserLanguageList $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.
PS> $LanguageList.Remove("lt-LT") False
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.
PS>$LanguageList[1] LanguageTag : lt-LT Autonym : lietuvių EnglishName : Lithuanian LocalizedName : Lithuanian ScriptName : Latin script InputMethodTips : {0427:00010427} Spellchecking : True Handwriting : False
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").
$LanguageList.Remove($LanguageList[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.
Set-WinUserLanguageList $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.
$LanguageList.Remove(($LanguageList | Where-Object LanguageTag -like 'lt-LT'))
This will return True, and we follow it up again with our Set command:
Set-WinUserLanguageList $LanguageList
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.
Subscribe to 4sysops newsletter!
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.
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
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:
cd C:\
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
Hi Bryce,
thank you for replying so soon.
Here is what I got:
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
Hi, you need to fill the contents of your LanguageList object first.
You do it with this line: $LanguageList = Get-WinUserLanguageList
Then you can remove or add as many languages to that object, and after you're done, you can replace your current object with the one you created, like this:
Set-WinUserLanguageList $LanguageList
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
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
we have a couple laptops that came with UK English Keyboard (meaning there a couple of keystrokes that are not in the same place as US Keyboard) and we have installed windows 10 1809 US English ISO on them is there anyways to change the windows language to UK including keyboard layout? we have tried to download UK language and region& settings -> time and language -> language and region -> administrative language settings
and can copy language settings to the welcome screen and new accounts
but when the user login to the computer it will change back to US keyboard. And also we’re using mandatory profile
You can try this:
$languages = Get-WinUserLanguageList
$languages.Clear()
$languages.add("en-GB")
Set-WinUserLanguageList $languages -Force
Hi,
I am trying to figure out all the English language users in AD. The given command "get-winuserlanguagelist" only provide single user information.
Is there any way I can get all users language info.
Thanks
Shekhar
Hi Bruce. There is a problem here. I have a language (Unknown locale "qaa-latn" Russian keyboard) in the languages list. It is not registered under the Language preferences in Settings. Nor is it shown in the PowerShell under the language list. I can add "qaa-latn" language through the "add language," however, it adds en-us Latin keyboard, and I cannot add the Russian keyboard to remove it later as it is Cyrillic. So I am unable to remove it. Is there a way to add a specific ScriptName keyboard while adding a language through the PowerShell? Thanks in advance for your answers.