How to Enable WinRM to Allow Remote PowerShell Management

Photo of author

By Victor Ashiedu

Published

If you try making a remote PowerShell connection to a computer but the WinRM is not enabled, you’ll receive the error message in the screenshot below.

If you receive this error message, use the three steps below to enable WinRM and configure the necessary Windows Firewall rules.

Step 1: Set Network Connection Profile to Domain or Private

Part of the process of enabling WinRM is to configure WinRM firewall exception.

Unfortunately, the setup will not configure firewall exceptions if the network interface connection profile is set to Public.

To fix this problem, you must configure all network interfaces on the remote computer to either Domain or Private.

If the computer you’re remoting to is joined to the domain, the network connection profile will be set to Domain. In that case, you can skip this section.

But, if you need to set the network connection to Private for a non-domain-joined computer, follow these steps:

  1. Open PowerShell as administrator. Then, get the name of the network interface with the command below:
Get-NetAdapter

The command displays all network adapters on the computer, including their Name. My screenshot below shows two network adapters – “Ethernet 2” and “Ethernet.”

In this example, I’ll be configuring the “Ethernet” network card.

  1. Finally, set the network connection profile to Private with the command below:
I used the InterfaceIndex of the network card to identify it.
Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private

Here are the commands – to confirm that the connection profile has changed, I executed the Get-NetConnectionProfile command.

Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private

Step 2: Enable WinRM with the WinRM quickconfig Command

The fastest way to enable WinRM and open the necessary Windows Firewall ports is by running the “winrm quickconfig” command.

To run this command, open CMD as administrator. Then, proceed with the steps below.

  1. Run the “winrm quickconfig” command.
winrm quickconfig
  1. You’ll be prompted to confirm that you’re happy to start the WinRM service. Type y and press the enter key.
  1. In the next step, the process will prompt you to confirm “Enabling the WinRM firewall exception.” Type y and press enter.

The process is very quick and you should receive a confirmation that the configuration is completed.

The process is very quick and you should receive a confirmation that the configuration is completed.

Step 3: Add Both Computers to the TrustedHosts Lists

This final step is required if the authentication scheme on the computers is different from Kerberos, or if the client computer is not joined to a domain.

So, if you’re configuring a non-domain-joined computer, you must add the source and destination computers to the others’ TrustedHosts lists.

Open PowerShell as administrator and run the commands below:

The following commands must be executed on the source and destination computers. In my sample command below, 192.168.0.58 is the IP address of the remote computer. So, I executed the first command on the source computer (the computer I am making the PowerShell connection from). The second command is executed on the remote computer – 192.168.0.56 is the IP address of the source computer.
winrm set winrm/config/client '@{TrustedHosts="192.168.0.58"}'
winrm set winrm/config/client '@{TrustedHosts="192.168.0.56"}' 
winrm set winrm TrustedHosts - source computer

Conclusion

Configuring WinRM is a prerequisite to making a remote connection with PowerShell. As I discussed in this guide, this is a three-step process.

Firstly, you must set the network connection profile for the interface on the remote computer to Domain or Private. Additionally, enable WinRM by running the “WinRM quickconfig” command.

Finally, you must add the source and destination computers to the TrustedHosts lists on each computer.

Once you finish these three configurations, you can make a remote PowerShell connection using the New-PSSession or Enter-PSSession commands.

Thank you for reading!

If this article fixed the problem you intended it to, click Yes to the “Was this page helpful?” question below.

However, if it does not meet your expectations, click No and give us as much information as possible – we take your feedback very seriously.

Before you go, you may want to browse our Windows PowerShell how-to guides for more exciting PowerShell hands-on articles.

About the Author

Photo of author

Victor Ashiedu

Victor is the founder of InfoPress Media, publishers of Ilifeguides and Itechguides. With 20+ years of experience in IT infrastructure, his expertise spans Windows, Linux, and DevOps. Explore his contributions on Itechguides.com for insightful how-to guides and product reviews.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment

Send this to a friend