faceless
faceless

Reputation: 488

Changing keyboard layout in PowerShell for multiple languages

This question is an extended version of THIS

In windows-10 I need to programatically add 3 languages: en-US, SV, RU.

It works well with the following command:

Set-WinUserLanguageList en-US, sv, ru -Force

The problem is that this way system adds the default keyboard layout for every language, whereas i need a different layout for russian - 0419:A0000419 (preinstalled)

Tried to solve the puzzle with this:

  $rusLang = New-WinUserLanguageList ru
  $rusLang[0].InputMethodTips.Clear()
  $rusLang[0].InputMethodTips.Add('0419:A0000419') # required layout
  Set-WinUserLanguageList en-US, sv, $rusLang

It didn't do the trick. Failed with InvalidArgument: (:) [Set-WinUserLanguageList], ParameterBindingException

I do not care whether the RU language will be added with the desired InputMethodTips, or this param is overwritten after the Set-WinUserLanguageList en-US, sv, ru -Force

How can it be acheived?

Upvotes: 4

Views: 7623

Answers (1)

Vad
Vad

Reputation: 743

Try use this code from here

Dism /Image:"C:\mount\windows" /Set-InputLocale:042d:0000040a
Dism /Image:"C:\mount\windows" /Set-InputLocale:0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}
Dism /Image:"C:\mount\windows" /Set-InputLocale:id-ID
Dism /Image:"C:\mount\windows" /Set-AllIntl:fr-FR

Or you can use like this:

  $Lang = New-WinUserLanguageList en-US #you cant add all language at time(of course you can piping it)
  $Lang.Add("sv") #you must add it simple
  $Lang.Add("ru")
  $Lang[2].InputMethodTips.Clear()
  $Lang[2].InputMethodTips.Add('0419:A0000419') # required layout
  Set-WinUserLanguageList -LanguageList $Lang #input must be in format System.Collections.Generic.List<Microsoft.InternationalSettings.Commands.WinUserLanguage>

Upvotes: 6

Related Questions