Powershell 遠端執行
開啟 PowerShell 一定要用 Run As Administrator 去執行
從建立連線開始
$s = New-PSSession -ComputerName 'ComputerName'
開始工作階段
Enter-PSSession -Session $s
在遠端執行 script
Invoke-Command -ComputerName 'ComputerName' { Get-Process }
離開連線
Exit-PSSession
詳情請參考:
https://docs.microsoft.com/zh-tw/powershell/scripting/core-powershell/running-remote-commands?view=powershell-6
留言
張貼留言