Introduction
PowerShell Remoting is a powerful feature that allows administrators to manage remote systems seamlessly. However, setting up PowerShell Remoting isn’t always a straightforward process. Sometimes, you may encounter errors like the one below when trying to enable PowerShell Remoting:
``powershell
PS C:\Windows\system32> Enable-PSRemoting
WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.
Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://sche
mas.microsoft.com/wbem/wsman/1/wsmanfault"
Code="2150859113"
Machine="localhost"><f:Message><f:ProviderFault
provider="Config provider"
path="%systemroot%\system32\WsmSvc.dll"><f:WSManFault xml
ns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfaul
t" Code="2150859113"
Machine="DESKTOP-5V4LEIG"><f:Message>WinRM firewall
exception will not work since one of the network
connection types on this machine is set to Public.
Change the network connection type to either Domain or
Private and try again. </f:Message></f:WSManFault></f:Pro
viderFault></f:Message></f:WSManFault>
At line:116 char:17
+ Set-WSManQuickConfig -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set
-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan
.Management.SetWSManQuickConfigCommand
PS C:\Windows\system32>
`
This error message indicates that the WinRM (Windows Remote Management) configuration is encountering issues related to network connection types, typically when the network connection is set to “Public.” In this article, we’ll guide you through solving this issue and enabling PowerShell Remoting on your Windows system.
Understanding the Error
The error message you encountered is quite descriptive. It tells us that the WinRM configuration failed because the network connection type is set to “Public.” WinRM firewall exceptions are not enabled for “Public” network profiles, which is a security measure in Windows. To resolve this issue, we need to change the network connection type to either “Domain” or “Private.”
Step-by-Step Solution
Follow these steps to solve the WinRM configuration error and enable PowerShell Remoting:
1. Open PowerShell as Administrator
Make sure you run PowerShell as an administrator to have the necessary permissions to modify the network settings.
2. Check Current Network Connection Profile
Run the following command to check the current network connection profile:
`powershell
Get-NetConnectionProfile
``
This command will provide information about your network connection. Note the name of the network profile, as it will help you choose the appropriate network profile to set.
3. Change Network Connection Profile
Use the Set-NetConnectionProfile cmdlet to change the network connection profile to "Domain" or "Private." For example, if your network profile is currently set to "Pu