qshinoの日記

Powershell関係と徒然なこと

powershell remote on ssh

option for ssh session

New-PSSession, Enter-PSSession, and Invoke-Command
[-HostName <string>]  [-UserName <string>]  [-KeyFilePath <string>]

sample code

Linux to windows

Enter-PSSession -HostName WinVM1 -UserName PTestName

win to win

$session = New-PSSession -HostName WinVM2 -UserName PSRemoteUser

Enter-PSSession -Session $session

ref

https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core?view=powershell-7.2