Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ebicoglu/629d029be0218417e1a64b7006887e2f to your computer and use it in GitHub Desktop.

Select an option

Save ebicoglu/629d029be0218417e1a64b7006887e2f to your computer and use it in GitHub Desktop.
Removes all the keyboard layouts except TURKISH-Q with Powershell
# KEYBOARD LAYOUT CODES
# https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-input-locales-for-windows-language-packs?view=windows-11
$LangCodeToKeep = '0409:0000041F' #TURKISH-Q
# Get all current language lists
$langs = Get-WinUserLanguageList
# Remove everything except en-US
$keep = $langs | Where-Object { $_.LanguageTag -eq 'en-US' }
# If en-US doesn't exist, create it
if (-not $keep)
{
$keep = New-WinUserLanguageList 'en-US'
}
# Create a fresh en-US language object
$newLang = New-WinUserLanguageList 'en-US'
# Replace its InputMethodTips with only selected language code
$newLang[0].InputMethodTips.Clear()
$newLang[0].InputMethodTips.Add($LangCodeToKeep)
# Apply only this language and keyboard
Set-WinUserLanguageList $newLang -Force
Write-Host "Only language with keyboard layout code $LangCodeToKeep has been kept."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment