hits counter

Remove Rogue Keyboard Layout From Windows Session Using PowerShell

Over the years I've been hit by having a US QWERTY keyboard layout added to my Windows session without knowing where it came from.

Today I decided to do something about it.

Using the International PowerShell module, we can get the list of user languages using the Get-WinUserLanguageList PowerShell CmdLet.

In my case (and en-US and pt-PT languages with Portuguese keyboard layout) that will usually be:

LanguageTag : en-US
Autonym : English (United States)
EnglishName : English
LocalizedName : English (United States)
ScriptName : Latin
InputMethodTips : {0409:00000816}
Spellchecking : True
Handwriting : False

LanguageTag : pt-PT
Autonym : Português (Portugal)
EnglishName : Portuguese
LocalizedName : Portuguese (Portugal)
ScriptName : Latin
InputMethodTips : {0816:00000816}
Spellchecking : True
Handwriting : False

However, sometimes I get into this situation:

LanguageTag : en-US
Autonym : English (United States)
EnglishName : English
LocalizedName : English (United States)
ScriptName : Latin
InputMethodTips : {0409:00000816, 0409:00000409}
Spellchecking : True
Handwriting : False

LanguageTag : pt-PT
Autonym : Português (Portugal)
EnglishName : Portuguese
LocalizedName : Portuguese (Portugal)
ScriptName : Latin
InputMethodTips : {0816:00000816}
Spellchecking : True
Handwriting : False

That extra input method can be removed from the list using this PowerShell script:

$WinUserLanguageList = Get-WinUserLanguageList
foreach ($WinUserLanguage in $WinUserLanguageList) {
$toRemove = $WinUserLanguage.InputMethodTips | Where-Object { $_ -notlike '*:00000816' }
foreach ($item in $toRemove) {
$null = $WinUserLanguage.InputMethodTips.Remove($item)
}
}
Set-WinUserLanguageList $WinUserLanguageList -Force

If you're into one-liners, here it is:

$WinUserLanguageList = Get-WinUserLanguageList; $WinUserLanguageList | % { $WinUserLanguage = $_; $toRemove=$WinUserLanguage.InputMethodTips | ? { $_ -notlike '*:00000816' }; $toRemove | % { $null = $WinUserLanguage.InputMethodTips.Remove($_) }}; Set-WinUserLanguageList $WinUserLanguageList -Force

No Comments

Add a Comment

As it will appear on the website

Not displayed

Your website