Configure and listen successfully using WinRM in powershell

sanya picture sanya · Jun 24, 2013 · Viewed 45.1k times · Source

I'm testing WinRM connection using Command Prompt on my local and remote machine and my question is devided into two parts.

PART I

I tested TCP/IP connectivity by using ping command to ping : IP Address of local computer and remote computer, default gateway and DNS Server and it runs perfectly on both local and remote computer.

But when testing using WinRM commands, I used this command to locate listeners and addresses

winrm e winrm/config/listener

It gives me this output for my local machine

Listener
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn =<IP Address>,127.0.0.1, ::1,fe80::100:7f:fffe%13,fe80::803:5e43:50ef:c50%11

But the same command when I run on remote machine gives me an output with everything else the same, except

Listener[Source="GPO"]
.
.
.
ListeningOn=null

I want to configure it to make it listen correctly.

PART II

And when I run these commands one by one on my remote machine

winrm id -r:<machine name>
winrm get winrm/config -r:<machine name>
winrm get wmicimv2/Win32_Service?Name = WinRM -r:<machine name>

It gives a WSMan Fault with an error message as :

The client cannot connect to the destination specified in the request. Verify
that the service on the destination is running and is accepting requests.Consult
the logs and documentation for WS-Management service running on the destination,
most commonly IIs or WinRM. If the destination is the WinRM service, run the 
following command on the destination to analyse and configure the WinRM service:
"winrm quickconfig". 

Whereas, same commands when I run on my local machine run correctly.

winrm id 
winrm get winrm/config
winrm get wmicimv2/Win32_Service?Name = WinRM

At most, all the problems I'm facing is on my remote machine. What is causing this to happen and how can I configure it to listen and connect successfully? Thank You.


Part II, I am now able to run these on one of my other remote machines with correct output.

I made some changes in this particular remote machine for which I had posted the question and so, it wouldn't run these commands until I fix the part I but besides that if nothing has been altered it will run just like it does on my other remote machines.

I would still appreciate if someone could help me with part I in which I have to get rid of

Listener[Source=GPO]
..
.
ListeningOn=null

when I run the command

winrm e winrm/config/listener

because this is what is causing issues but I'm not sure how to disable/remove Group Policy Settings.

Answer

Neossian picture Neossian · Sep 4, 2013

To determine which group policy is configuring your WinRM you can run the following from an administrative command prompt:

gpresult /h result.html & result.html

In the displayed result, locate Windows Components/Windows Remote Management (WinRM)/WinRM Service. The Winning GPO is where you can enable/disable GPO settings. Use GPMC (Group Policy Management Console) to manage the Group Policy.

ListeningOn=null appears when an administrator has incorrectly configured the Group Policy IPv4 filter setting in Allow automatic configuration of listeners usually with an IP or network that does not exist on the affected Server.