Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove language from Windows 10 using PowerShell

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 cannot find a guide to remove it again or to change the layout. I also want to ask the user if he wants to add or to remove a language.

This is my code:

$List = Get-WinUserLanguageList
$List.Add("lt-LT")
Set-WinUserLanguageList $List

Thank you in advance.

like image 682
Daina Hodges Avatar asked Nov 28 '17 19:11

Daina Hodges


People also ask

How do I remove languages from Windows 10?

Remove extra language packs or keyboard languagesSelect Start > Settings > Time & language > Language & region. Under Preferred languages, select the language you want to remove, and then select Remove.

How do I delete an installed language?

Click File > Options > Language. Under Choose Editing Languages, select the language that you want to remove, and then click Remove.

Can't remove Windows display language?

On the Time & language page, select Language on the left sidebar. On the right pane, scroll down to the Preferred languages section. In it, locate the Windows 10 language pack that you want to uninstall and select it by clicking or tapping on it. Then, press the Remove button on the right of that language.

How do I remove English US from Windows display language?

Go to Settings, Time and language, Region and language, first make sure that the language you want to leave this as Default, then you click on the LANGUAGE you want to delete and click on Remove. The problem should be solved.


1 Answers

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

like image 89
Bryce McDonald Avatar answered Sep 22 '22 19:09

Bryce McDonald