Cyber Deals - Get up to 65% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

Ansible for Windows

Checkout the Ansible Automation for Windows guides.

WinRM vs OpenSSH – Pros & Cons

Ansible supports managing Windows hosts using two connection types:

  • WinRM (Windows Remote Management) – default and traditional method.
  • OpenSSH – newer method, especially post-Windows 10 / Server 2019.

WinRM (Default)

✔️ Pros

ProsDescription
✅ Native SupportBuilt-in to Windows OS; enabled and configured on most enterprise systems.
✅ Full Module CompatibilityAll Ansible Windows modules are fully tested with WinRM.
✅ PowerShell-centricDesigned for PowerShell automation and WinRM natively uses it.
✅ Kerberos & Domain IntegrationSupports AD/Kerberos for seamless authentication in domain environments.
✅ Mature & DocumentedWinRM has been the default for years; tons of docs, blogs, support.

❌ Cons

ConsDescription
❌ Complex ConfigurationRequires setting up listeners, ports (5985/5986), HTTPS, certificates, etc.
❌ Firewall HasslesExtra firewall rules needed; port 5986 often blocked by security policies.
❌ Slow PerformanceKnown to be slower than SSH in many operations.
❌ SSL Certificate SetupSecure mode needs signed certs, which is painful in many orgs.
❌ Occasional Encoding IssuesEspecially with special characters or non-English content.
❌ No Agent ForwardingUnlike SSH, WinRM lacks native support for agent/key forwarding.

🆕 OpenSSH

✔️ Pros

ProsDescription
✅ Simpler SetupJust install OpenSSH, open port 22, and you’re good to go.
✅ Uses Existing SSH WorkflowEasy integration for teams already using SSH in Linux/macOS.
✅ Better PerformanceUsually faster than WinRM in most tasks.
✅ Standard PortUses port 22, often already open in mixed environments.
✅ Easier Key ManagementSupports SSH keys (no need for certs or complex auth).
✅ Works with SSH AgentSupports ssh-agent and agent forwarding.
❌ Cons
ConsDescription
❌ Not Fully SupportedSome Ansible Windows modules may not work or behave differently.
❌ Requires Extra SetupOpenSSH is not enabled by default on all Windows versions (esp. older).
❌ Limited AD/KerberosNo built-in support for domain/Kerberos auth like WinRM.
❌ Troubleshooting May Be HarderErrors are often lower-level and less descriptive.
❌ Inconsistent Shell ExperienceSome PowerShell-specific commands may behave oddly under SSH shell.

💡 Use Case Scenarios

ScenarioRecommendation
Domain-joined environmentWinRM (for Kerberos & seamless integration)
Hybrid/mixed Linux-Windows infraOpenSSH (for consistency and ease)
Security restrictions on custom portsOpenSSH (uses port 22)
Need speed and simplicityOpenSSH
Complex legacy systems with existing WinRM setupWinRM
AD authentication is mandatoryWinRM

📝 Summary Recommendation for Proposal

Default Option: Start with WinRM if compatibility and AD integration are top priority, especially for large enterprise or domain-joined machines.

Alternative Option: Consider OpenSSH if:

  • New environment with fewer legacy dependencies.
  • You’re already using SSH keys.
  • You want faster and easier setup.
  • The infrastructure team prefers standard SSH tooling.

Long-Term Plan: Evaluate hybrid usage, or standardize on OpenSSH as it becomes more mature and broadly supported.

📋 Proposal Add-on: Migration/Decision Factors

If switching between connection methods, consider:

  • Compatibility check for required modules.
  • Authentication needs (Kerberos vs SSH keys).
  • Security team policies (ports, protocols).
  • User familiarity (PowerShell vs bash-like environments).
  • Automation tools and their SSH/WinRM compatibility.

CredSSP

Enable CredSSP

Error: “credssp: Server did not response with a CredSSP token after step TLS Handshake - actual ‘’”,

ansible_winrm_credssp_disable_tlsv1_2

Patching windows servers through Ansible