PowerShell : Enable WinRm on Windows

Step 01

Download the PowerShell script provided by Ansible here: ConfigureRemotingForAnsible.ps1

Note: To execute the script, Administrator access is required.

Step 02

Now, go to the script download location and open the Command Prompt as an ‘Administrator’ and run the following command:

1
powershell.exe -ExecutionPolicy Bypass -File ConfigureRemotingForAnsible.ps1 -CertValidityDays 100

Note: Ensure that port 5986 is open in firewall rules.

That’s all you need, to enable WinRm on windows!