Unremovable Keyboard Layout Issue on Windows 10

keyboard-layout

It seems that in a recent update a keyboard layout was added to my keyboard layout list, which is "Spanish (Mexico)". This layout doesn't appear on the Region & Language configuration tab.

Keyboard layout list:

Keyboard layout list

Region & Language:

Region & Language

It's really annoying, how can I remove it?

Best Answer

Import-Module -Name International -Force
$WinUserLangList = Get-WinUserLanguageList
Set-WinUserLanguageList -LanguageList $WinUserLangList -Force

Restart-Computer -Confirm -Force        #  !!! May be important !!!  #

Above PowerShell script should do the trick however I don't comprehend whether the last command Restart-Computer is really necessary (sometimes it's required to complete the job).

The extra input language(s) in the language bar could be identified using the DISM utility (Deployment Image Servicing and Management tool, requires elevation) in the Active keyboard(s) line as DISM.exe /Online /Get-Intl. Example:

DISM.exe /Online /Get-Intl | findstr /i "Active.keyboard"
Active keyboard(s) : 0809:00000405, 0405:00000405, 0405:00020409, 0408:00010408, 0419:00020419, 041b:0000041b, 041f:0000041f, 041f:00000426, 0425:00000425, 0425:00010409, 0809:00000452

In fact, those values are stored under the following registry keys:

HKEY_USERS\.DEFAULT\Control Panel\International\User Profile
HKEY_USERS\.DEFAULT\Control Panel\International\User Profile System Backup

I wrote the following script to get a human-legible output instead of dark and obscure 0419:00020419, 041b:0000041b, …

$regBase = 'Registry::' + 
           'HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layouts'
Function Get-Intl {
param( [string]$InputMethodTip )
    $auxlang, $auxKeyb = $InputMethodTip -split ':'
    $auxLangIn = [System.Globalization.CultureInfo]::
                    GetCultureInfo( [int]"0x$auxlang" ) # -band 0x3FF )
    [psCustomObject]@{
        InputMethodTip = $InputMethodTip
        Name           = $auxLangIn.Name
        # Autonym        = $WinUserLanguage.Autonym
        KbdLayoutName  = Get-ItemPropertyValue -Name 'Layout Text' -Path (
                            Join-Path -Path $regBase -ChildPath $auxKeyb
                        ) -ErrorAction SilentlyContinue
    }
}

'--- Get-WinUserLanguageList output:'
ForEach ( $WinUserLanguage in ( Get-WinUserLanguageList ) ) {
    $WinUserLanguage.InputMethodTips | ForEach-Object {
        Get-Intl -InputMethodTip $_
    }
}
'=== HKEY_USERS/DISM.EXE output:'
$regDefa = 'Registry::' + 
           'HKEY_USERS\.DEFAULT\Control Panel\International\User Profile'
# HKEY_USERS\.DEFAULT\Control Panel\International\User Profile System Backup
Get-ChildItem -Path $regDefa -Force | 
    Select-Object -ExpandProperty Property |
        Where-Object { $_ -match ':' } | 
            ForEach-Object {
                Get-Intl -InputMethodTip  $_
            }

Output (truncated):

D:\PShell\tests\InputMethodTip.ps1
--- Get-WinUserLanguageList output:

InputMethodTip Name  KbdLayoutName              
-------------- ----  -------------              
0809:00000452  en-GB United Kingdom Extended    
0405:00000405  cs-CZ Czech                      
0405:00020409  cs-CZ United States-International
0408:00010408  el-GR Greek (220)                
0419:00020419  ru-RU Russian - Mnemonic         
=== HKEY_USERS/DISM.EXE output:
0809:00000452  en-GB United Kingdom Extended    
0405:00000405  cs-CZ Czech                      
…
Related Question