WinRM is a powerful tool that allows you to manage and configure remote Windows computers securely. In this tutorial, I will explain how to enable WinRM (Windows Remote Management) using PowerShell. Let me show you examples.
What is WinRM?
WinRM is a protocol that allows you to interact with remote computers using a set of standard APIs. It leverages the WS-Management protocol to facilitate remote management and automation tasks. With WinRM, you can execute commands and scripts and even manage Windows services on remote machines.
Note: You should have administrative privileges on the local and remote computers.
Now, let me show you step-by-step how to enable WinRM using PowerShell.
Enable WinRM Using PowerShell
Now, let’s walk through the steps to enable WinRM using PowerShell.
Step 1: Open PowerShell as Administrator
To get started, open PowerShell as an administrator. This is very important because enabling WinRM requires elevated privileges. To do this:
- Press the Windows key and type “PowerShell”
- Right-click on “Windows PowerShell” and select “Run as administrator”
Step 2: Check the Current WinRM Status
Before enabling WinRM, it’s a good idea to check its current status. Run the following command:
winrm quickconfigIf WinRM is already enabled, you will see a message indicating that WinRM is already running on this machine. If WinRM is not enabled, you will see a prompt asking if you want to enable it.
I executed the above PowerShell script in my local system, and you can see the exact output in the screenshot below.

Check out Enable Remote Desktop Using PowerShell
Step 3: Enable WinRM
If WinRM is not enabled, you can enable it using the following command:
Enable-PSRemoting -ForceThe Enable-PSRemoting cmdlet configures the computer to receive PowerShell remote commands sent using the WS-Management technology. The -Force parameter skips the confirmation prompt.
Alternatively, you can use the winrm quickconfig command to enable WinRM and set up the default configuration for remote management:
winrm quickconfigThis command will prompt you to enable WinRM if it is not already enabled.
Step 4: Configure WinRM Listener
By default, WinRM listens on HTTP port 5985. However, you can configure it to listen on HTTPS port 5986 for added security. To configure the WinRM listener, use the following command:
winrm set winrm/config/service '@{EnableCompatibilityHttpListener="true"}'This command enables the compatibility HTTP listener, allowing WinRM to accept both HTTP and HTTPS connections.
Check out Uninstall a Program with PowerShell
Step 5: Set WinRM Service to Start Automatically
To ensure that WinRM starts automatically when your computer boots up, set the WinRM service startup type to “Automatic” using the following command:
Set-Service -Name WinRM -StartupType AutomaticStep 6: Test WinRM Connectivity
Once you have enabled and configured WinRM, it’s crucial to test the connectivity. Let’s say you want to test the WinRM connectivity from your local computer (e.g., named “JohnsLaptop”) to a remote computer (e.g., named “SarahsDesktop”). Run the following command:
Test-WSMan SarahsDesktopIf the test is successful, you will see output similar to the following:
wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor : Microsoft Corporation
ProductVersion : OS: 0.0.0 SP: 0.0 Stack: 3.0This confirms that WinRM is enabled and accessible on the remote computer.
Check out Uninstall Microsoft Edge Using PowerShell
Troubleshooting WinRM Connection Issues
If you encounter issues while connecting to a remote computer using WinRM, here are a few troubleshooting tips:
- Verify that WinRM is enabled on both the local and remote computers by running
winrm quickconfig. - Check the firewall settings on the remote computer. Ensure that the necessary ports (5985 for HTTP and 5986 for HTTPS) are open.
- Ensure that the remote computer is accessible over the network and that there are no connectivity issues.
- Verify that the user account you are using has the necessary permissions to access the remote computer.
- Check the group policies that may be configuring WinRM on the remote computer. Run the following command from an administrative command prompt:
gpresult /H C:\GPO_Report.htmlOpen the generated HTML report and search for “WinRM” to identify the relevant group policies.
Conclusion
In this tutorial, we covered the steps to enable WinRM using PowerShell. We started by understanding what WinRM is and its importance in remote management. We then walked through the process of enabling WinRM, configuring the listener, setting the service startup type, and testing the connectivity. Additionally, we provided troubleshooting tips for common WinRM connection issues.
Let me know in the comment below if you face any issues while enabling WinRM using PowerShell.
You may also like:
- How to Set Proxy in PowerShell?
- How to Uninstall Firefox Using PowerShell?
- Get and Set Window Size in PowerShell
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.