Image Here For Reference Specifically the text after "Similarity" and "->"
I have a small PowerShell script that uses ssh to connect to a server and run a command. I believe it produces unreadable output due to some of the text having to be in colour.
I've tried adding the following, but still no luck:
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
CodePudding user response:
To define console encoding you can use following expressions.
Choose encoding you need.
$ConsoleEncoding = [System.Text.Encoding]::UTF8
Apply your encoding to console.
[Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding( "$( $ConsoleEncoding.BodyName )" )
CodePudding user response:
Solved it, turns out that the command I needed was ssh -t host command
to enable the colour display
More info here: https://explainshell.com/explain?cmd=ssh -t my_host my_command