How to Configure PowerShell Remoting over SSH in Windows 11

In mixed enterprise infrastructures comprising Windows, Linux, and macOS endpoints, system engineers traditionally relied on WinRM (Windows Remote Management) over WS-Management protocols (TCP ports 5985 and 5986) for PowerShell remoting. However, WinRM requires complex HTTP listener configurations, certificate provisioning, and firewall exceptions that do not integrate natively into non-Windows administrative environments.

Modern PowerShell (PowerShell 7+) supports native PowerShell Remoting over SSH. By establishing connections over standard OpenSSH infrastructure on port 22, administrators can execute remote sessions, manage background jobs, and transfer objects across heterogeneous operating systems without enabling WinRM or maintaining domain-dependent Kerberos trusts.

Prerequisites for SSH Remoting in Windows 11

To configure PowerShell remoting over SSH on a Windows 11 host, ensure the following components are installed:

  • PowerShell 7.x or later: Modern cross-platform PowerShell (pwsh.exe).
  • OpenSSH Server: The native Windows OpenSSH feature installed and running.

Installing and Starting the OpenSSH Server Feature

On the destination Windows 11 target machine:

  1. Right-click Start and open Terminal (Admin).
  2. Install OpenSSH Server using the Windows Capability manager:
    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
  3. Start the SSH daemon service and configure it for automatic startup:
    Start-Service sshd
    Set-Service -Name sshd -StartupType 'Automatic'
  4. Confirm the firewall rule allows incoming connections on port 22:
    Get-NetFirewallRule -Name *ssh* | Select-Object Name, DisplayName, Enabled, Direction

Configuring the sshd_config Subsystem for PowerShell

To enable PowerShell remoting sessions over SSH, OpenSSH must register PowerShell as an SSH subsystem:

  1. Open the OpenSSH configuration file in an administrative editor:
    notepad "$env:ProgramDatasshsshd_config"
  2. Scroll to the bottom of the configuration file. Under the Subsystem section, insert the following directive pointing to your PowerShell 7 executable:
    Subsystem powershell "C:/Program Files/PowerShell/7/pwsh.exe" -sshs -NoLogo -NoProfile
  3. Ensure password authentication or public key authentication is enabled:
    PasswordAuthentication yes
    PubkeyAuthentication yes
  4. Save and close the file.
  5. Restart the SSH service to reload the updated subsystem configuration:
    Restart-Service sshd

Connecting via Interactive SSH Remoting Sessions

From your client machine (running Windows 11, macOS, or Linux with PowerShell 7 installed), establish an interactive session using the -HostName and -UserName parameters:

Enter-PSSession -HostName 192.168.1.150 -UserName AdminUser

When prompted, accept the host key fingerprint and enter your password (or authenticate automatically using an SSH key pair stored in your local ~/.ssh/id_ed25519 directory). Your prompt changes to indicate an active remote session:

[[email protected]]: PS C:UsersAdminUserDocuments>

Executing Remote Commands and Scripts (Invoke-Command)

To execute one-off scripts, queries, or batch commands across remote endpoints without maintaining an interactive shell:

Invoke-Command -HostName 192.168.1.150 -UserName AdminUser -ScriptBlock {
    Get-ComputerInfo | Select-Object WindowsProductName, OsHardwareAbstractionLayer, BiosFirmwareType
}

This command dispatches the script block over an encrypted SSH transport, runs the instructions on the remote Windows 11 host, and deserialises the resulting objects back to your local PowerShell console.

Creating Reusable SSH Sessions (New-PSSession)

For complex orchestration routines, establish a persistent session object:

$sess = New-PSSession -HostName 192.168.1.150 -UserName AdminUser -KeyFilePath "$HOME/.ssh/id_ed25519"
Copy-Item -Path ./deploy.ps1 -Destination "C:/Deploy/" -ToSession $sess
Invoke-Command -Session $sess -ScriptBlock { & "C:/Deploy/deploy.ps1" }
Remove-PSSession -Session $sess

Deploying PowerShell remoting over SSH modernises remote administration, eliminates the security overhead of legacy WinRM listeners, and standardises cross-platform automation across your fleet.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.