← Knowledge Base
PowerShellReference note1 min read · updated 2026-11-27

Run commands on another machine with PowerShell remoting

Enter-PSSession and Invoke-Command, and PowerShell over SSH for cross-platform use.

powershellremotingssh
Enable-PSRemoting -Force                              # on the target (elevated); allows WinRM
Enter-PSSession -ComputerName srv1                    # interactive
Invoke-Command -ComputerName srv1,srv2 -ScriptBlock { Get-Service wuauserv }
$s = New-PSSession -ComputerName srv1; Invoke-Command $s { hostname }; Remove-PSSession $s
Enter-PSSession -HostName ubuntu-host -UserName alice   # PowerShell 7 over SSH

On a domain, Kerberos handles authentication; for machines outside a domain you must configure TrustedHosts or use HTTPS/SSH transport. Open firewall access only for management networks. Use the least privileged account that can do the job, and prefer SSH keys for Linux targets.