How do I open a PowerShell remoting session over SSH?
PowerShell remoting over SSH is a distinct feature from typing ssh into PowerShell. It requires a compatible PowerShell installation and a configured PowerShell SSH subsystem on the remote server. Windows PowerShell 5.1 does not provide the SSH HostName parameter set.
Before you start
- An administrator has configured and authorised the remote PowerShell SSH subsystem.
Instructions
1. Confirm local remoting support
Use a supported PowerShell 7 installation for this workflow and inspect the available parameter sets.
(Get-Command New-PSSession).ParameterSets.NameLook for SSH-related parameter sets. Their absence means this shell cannot use the demonstrated SSH remoting workflow.
2. Connect to a preconfigured endpoint
The server administrator must already have configured the subsystem and approved your account. Keep normal SSH host verification enabled.
Enter-PSSession -HostName 203.0.113.10 -UserName adminuser -KeyFilePath "$env:USERPROFILE\.ssh\server_ed25519"This requests a PowerShell remoting session over SSH. It will not create the required server subsystem automatically.
3. Verify the remote PowerShell process
Inside the remote Windows session, check identity and version before continuing.
hostname
$PSVersionTable.PSVersion
Exit-PSSessionThe first two commands identify the remote endpoint. Exit-PSSession returns you to the local PowerShell session.
Check the result
- The remote endpoint opens a PowerShell session with the expected account and hostname.
- Exit-PSSession returns to the original local session.
Troubleshooting
- HostName is not a recognised parameter
- You may be using Windows PowerShell 5.1 instead of supported PowerShell 7.
- Subsystem request failed
- Ordinary SSH may work while the PowerShell subsystem is absent or misconfigured. Follow the server’s approved subsystem setup procedure.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
