10 lines
495 B
PowerShell
10 lines
495 B
PowerShell
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
|
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
|
|
$r = Invoke-SSHCommand -SSHSession $s -Command "grep -E 'AECH|注册|RDM|心跳' ~/butler.log | tail -20"
|
|
Write-Host ($r.Output -join "`n")
|
|
Remove-SSHSession $s | Out-Null
|