[Console]::OutputEncoding = [Text.Encoding]::UTF8 $ErrorActionPreference = "Stop" Import-Module Posh-SSH $sec = ConvertTo-SecureString "0" -AsPlainText -Force $cred = New-Object PSCredential("tonycao", $sec) $s = New-SSHSession -ComputerName 192.168.58.7 -Credential $cred -AcceptKey -ConnectionTimeout 15 if (-not $s) { throw "SSH connect failed" } $r = Invoke-SSHCommand -SessionId $s.SessionId -Command "which git && git --version && ls ~/enet-validator 2>/dev/null | head -5" $r.Output Remove-SSHSession -SessionId $s.SessionId | Out-Null