12 lines
632 B
PowerShell
12 lines
632 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 "tail -n 400 ~/butler.log | grep -nE 'AECH|认领|注册|claim|register|89B' | tail -n 20; echo ---TAIL---; tail -n 5 ~/butler.log"
|
|
$r.Output
|
|
Remove-SSHSession -SSHSession $s | Out-Null
|