12 lines
627 B
PowerShell
12 lines
627 B
PowerShell
|
|
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
||
|
|
$ErrorActionPreference = "Stop"
|
||
|
|
Set-ExecutionPolicy -Scope Process Bypass -Force
|
||
|
|
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 -SSHSession $s -Command "pgrep -af enet; echo ---; ls -la ~/butler.log; echo ---; tail -n 3 ~/butler.log; echo ---; ss -lunp 2>/dev/null | grep 31772"
|
||
|
|
$r.Output
|
||
|
|
Remove-SSHSession -SSHSession $s | Out-Null
|