PS C:\Users\Work> Function Get-CurrentInputLanguage {
>> $ScriptBlock = {
>> Add-Type -AssemblyName System.Windows.Forms
>> [System.Windows.Forms.InputLanguage]::CurrentInputLanguage
>> }
>> $Job = Start-Job -ScriptBlock $ScriptBlock
>> $Null = Wait-Job -Job $Job
>> $CurrentLanguage = Receive-Job -Job $Job
>> Remove-Job -Job $Job
>> Return $CurrentLanguage
>> }
PS C:\Users\Work>
Вывод при английской раскладке:
PS C:\Users\Work> (Get-CurrentInputLanguage).Culture
LCID Name DisplayName
---- ---- -----------
1033 en-US Английский (США)
PS C:\Users\Work> (Get-CurrentInputLanguage).layoutname
США
Вывод при русской раскладке:
PS C:\Users\Work> (Get-CurrentInputLanguage).Culture
LCID Name DisplayName
---- ---- -----------
1049 ru-RU Русский (Россия)
PS C:\Users\Work> (Get-CurrentInputLanguage).layoutname
Русская
PS C:\Users\Work>