a4aravind
a4aravind

Reputation: 1232

How to enable powershell remoting in Powershell V3?

I'm running powershell 3.0 in Windows 7 and I'm connected to a domain.

These are the logs I get when I run Enable-PSRemoting:

WinRM has been updated to receive requests.
WinRM service type changed successfully.

Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2"
Machine="localhost"><f:Message><f:ProviderFault provider="Config provider" path="%systemroot%\system32\WsmSvc.dll"><f:WSManFault
xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2" Machine="mycomputername.mydomainname"><f:Message>Unable to check the sta
the firewall. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:1 char:1
+ Set-WSManQuickConfig
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

Upvotes: 3

Views: 4491

Answers (4)

metablaster
metablaster

Reputation: 2184

In my case I had to add both "normal" rules as well as "compatiblity" rules:

Windows Remote Management - Compatibility Mode (HTTP-In)
Windows Remote Management (HTTP-In)

This are 4 rules in total.

Next step is to set Remote Address fields to Any for Public profile rules.

That did the trick, I can now modify all WinRM settings.

If the effect is not immediate, then select all 4 rules, disable them and enable again, then restart WinRM service.

Upvotes: 0

sm4rk0
sm4rk0

Reputation: 483

In my case, restarting the Windows Firewall service did the job.

Upvotes: 0

Dan
Dan

Reputation: 841

To add to a4aravind's answer,

I was experiencing a similar problem in a Server 2k12 Core environment, but simply adding the firewall rules didn't help. In my case, the machines that were playing up were on a domain (or had recently been in a domain). I found that I had to do the following:

  1. Open regedit.exe and delete HKLM:\SYSTEM\Policies\Microsoft\Windows Firewall. These are the GPO policy settings for Win. Firewall, and their presence seems to lock the scripts ability to query/change the firewall. These settings will be recreated by GP when an update happens, just make sure you are fast enough that an update doesn't happen (though the obligatory take a backup statement applies here*).
  2. As suggested by a4aravind, I had to manually add the firewall rules for WinRM. In my case I found that I had to have both rules within the predefined set - my machines had been configured with the Domain only rule and I had to add the public rule too.

Having made these changes I was able to run Enable-PSRemoting, and then gpupdate to reapply the domain firewall rules.

Hopefully that'll help someone in a similar situation. A similar error message that I had on some of the machines was "Unable to enable the firewall for WinRM". I believe this was caused by group policy, and occurs when the message "For your security, some settings are controlled by Group Policy" is shown.

Note: In my case, the affected servers had all been built from an image that had previously been joined to the domain and picked up some dodgy GPO policies which messed up WinRM, before being removed from the domain and then added to our catalog. Which goes to show that you should check your images before pushing out a few dozen server images.

Upvotes: 2

a4aravind
a4aravind

Reputation: 1232

Oops...in my Inbound Rules of the Firewall settings, the Windows Remote Management(HTTP-In) Rule was not added. I added it and the issue got resolved. So, make sure you have all the inbound rules configured for the WinRM(Http-In) in the Firewall settings

Upvotes: 2

Related Questions