Pcornel
Automation · PowerShell Automation

WinRM

Cheat sheet · https://pcornel.dk/topic.php?topic=5242

Back to the Topic

Answer

WinRM is the Windows service behind PowerShell Remoting, listening on 5985 for HTTP and 5986 for HTTPS. Enable it with Enable-PSRemoting and restrict access with firewall rules and TrustedHosts only when needed.

Remember

  • WinRM listens on 5985 (HTTP) and 5986 (HTTPS).
  • Enable-PSRemoting configures it.
  • TrustedHosts is needed outside a domain without HTTPS.

First checks

  • winrm enumerate winrm/config/listener — listeners
  • Test-NetConnection <host> -Port 5985 — HTTP port
  • winrm get winrm/config/service — service settings

Verify in this order

client → 5985/5986 → WinRM service → PowerShell

Where it usually breaks

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

WinRM · PowerShell operational reference

BoundaryWinRM reference
Runtime identityPowerShell edition/version + command/module source
Persistent intentScript/module/config prerequisites under source control
VerificationRead-only discovery → execution evidence → independent target read-back
Output contractStructured objects/streams before formatting
Failure boundarySeparate engine/binding from transport/API/native and target-state failures

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5242

Confirmation

Confirm action

Continue?