Remote management without RDP: PowerShell
How to manage a Windows Server machine with commands: WinRM, PowerShell over SSH, secure setup, and what to do when the graphical session is unavailable.
Updated August 23, 2026
RDP is convenient, but it needs bandwidth, a GUI, and an open port. For routine tasks — updates, restarting services, checking logs — the command line is faster and safer: one line instead of three minutes of clicking.
Option one: PowerShell over SSH
Windows Server 2022 and 2025 ship with a built-in OpenSSH server. This is the simplest path, especially if you already work with keys.
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service sshd -StartupType Automatic
New-NetFirewallRule -DisplayName "SSH" -Direction Inbound -Protocol TCP -LocalPort 22 `
-RemoteAddress 203.0.113.5 -Action Allow
Make PowerShell the default shell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell `
-Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force
The login key goes into C:\Users\<name>\.ssh\authorized_keys, and for administrators into C:\ProgramData\ssh\administrators_authorized_keys with permissions for SYSTEM and the Administrators group only, otherwise the server will ignore it. After that, disable password login in C:\ProgramData\ssh\sshd_config (PasswordAuthentication no) and restart the service.
Connecting is standard:
ssh Administrator@YOUR_ADDRESS
Option two: WinRM
A native Windows mechanism. Port 5985 (HTTP) or 5986 (HTTPS).
Enable-PSRemoting -Force
Set-NetFirewallRule -Name WINRM-HTTP-In-TCP -RemoteAddress 203.0.113.5
Never expose unencrypted 5985 to the internet. The right approach is an HTTPS listener with a certificate:
$c = New-SelfSignedCertificate -DnsName "vds.example.ru" -CertStoreLocation Cert:\LocalMachine\My
New-Item -Path WSMan:\Localhost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $c.Thumbprint -Force
New-NetFirewallRule -DisplayName "WinRM HTTPS" -Direction Inbound -Protocol TCP -LocalPort 5986 `
-RemoteAddress 203.0.113.5 -Action Allow
Working from another Windows machine:
$s = New-PSSession -ComputerName vds.example.ru -UseSSL -Credential (Get-Credential)
Invoke-Command -Session $s { Get-Service | Where-Object Status -eq Running | Select-Object -First 10 }
Enter-PSSession $s
What is convenient to do with commands
Restart-Service W3SVC # restart IIS
Get-WinEvent -LogName System -MaxEvents 20 # latest events
Get-Process | Sort-Object WS -Desc | Select-Object -First 10 Name, WS
Get-Volume | Select-Object DriveLetter, SizeRemaining
Restart-Computer -Force
Updates can also be installed without a GUI, see Windows Server updates.
Emergency access
If RDP, SSH, and WinRM all fail to respond, the “Console” tab in the panel at /hosting/vds/m/<id> in “Screen” mode (VNC) remains. It connects to the machine like a monitor and works independently of the network settings inside the OS. A text console over a serial port makes no sense for Windows.
Common mistakes
- Opening 5985 to the whole internet. That is machine management over an unencrypted channel. Always restrict the addresses and prefer HTTPS.
- Wrong permissions on
administrators_authorized_keys. The OpenSSH server silently ignores a file that others can write to. Fix it:icaclswith inheritance disabled for everyone except SYSTEM and Administrators. - The rule was created in the wrong network profile. Check the active profile:
Get-NetConnectionProfile. - Forgetting about NLA and passwords when disabling RDP. Before disabling RDP, make sure the alternative access works.
Make a habit of writing your setup commands to a file. Reinstalling the OS on the “Access” tab takes minutes, while restoring the settings from memory takes hours.