Enable WinRM On Windows Server
You can enable WinRM on the Windows Servers by following these steps:
-
Open an elevated PowerShell console on the Windows Server.
-
Run the following command to enable WinRM:
winrm quickconfig
-
When prompted, type
Y
to allow WinRM to create a listener and set the firewall rules. -
If you want to enable HTTPS for WinRM, run the following command:
winrm quickconfig -transport:https
-
When prompted, type
Y
to create a self-signed certificate. -
Open the Windows Firewall with Advanced Security.
-
Create a new inbound rule for port 5985 (for HTTP) or 5986 (for HTTPS) to allow incoming connections.
Once you have completed these steps, WinRM will be enabled on the Windows Server and you can connect to it using Ansible's WinRM connection plugin.