PavelTMN
asked on
Powershell: undecipherable localized output in a remote session
I have local and remote systems both with Russian display language. When trying to run a non-powershell command in a remote PS session I get undecipherable strings:
Remote session:
How do I fix remote output?
Thank you.
[remote-comp]: PS C:\Users\admin\Documents> net session
' ¿¿¿¿¿? -?¿ ¿<?+?-¿R¿.
The sessions only seem to differ in [Console]::OutputEncoding output.Remote session:
[remote-comp]: PS C:\Users\admin\Documents> [Console]::OutputEncoding
IsSingleByte : True
BodyName : koi8-r
EncodingName : ¿¿¿¿¿¿¿¿¿ (Windows)
HeaderName : windows-1251
WebName : windows-1251
WindowsCodePage : 1251
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 1251
Local session:PS C:\Windows\system32> [Console]::OutputEncoding
IsSingleByte : True
BodyName : cp866
EncodingName : ¿¿¿¿¿¿¿¿¿ (DOS)
HeaderName : cp866
WebName : cp866
WindowsCodePage : 1251
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : False
IsMailNewsSave : False
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 866
All relevant properties seem to be read-only.How do I fix remote output?
Thank you.
ASKER
The problem is not with PowerShell cmdlets. They are shown correctly. It's "old" commands like net session.
PS C:\> $OutputEncoding = [Console]::OutputEncodingIt works but changes seemingly nothing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No one else provided a solution
PS C:\> $OutputEncoding = [Console]::OutputEncoding
and see PS C:\> $OutputEncoding