I want to use Powershell to add or remove a language and change the keyboard layout from left to right or from right to left in Windows 10. I wrote code to add a language but I
I managed to do this by using the index of the English language in the $List array in combination with the Set-WinUserLanguageList cmdlet. I found it odd that I couldn't simply reverse the steps by using the $list.remove("lt-LT") method, as it returns False, so I set about recreating the list another way.
After you've added "lt-LT" to the list, I ran the first cmdlet again to see what we were working with:
$list = Get-WinUserLanguageList
Which returned an array with two objects. $list[0] Returned
LanguageTag : en-US
Autonym : English (United States)
EnglishName : English
LocalizedName : English (United States)
ScriptName : Latin script
InputMethodTips : {0409:00000409}
Spellchecking : True
Handwriting : False
and $list[1] returned
LanguageTag : lt
Autonym : lietuvių
EnglishName : Lithuanian
LocalizedName : Lithuanian
ScriptName : Latin script
InputMethodTips : {0427:00010427}
Spellchecking : True
Handwriting : False
So what we needed to do was ensure that Set-WinUserLanguageList only got one of the inputs. I ran the following and it set the Language list appropriately.
Set-WinUserLanguageList $($list[0])
And now only the appropriate list is returned when running Get-WinUserLanguageList