Recently I was trying to run an invoke-command on a several remote computers and I received this error…

This was an interesting error for me as I had run the exact same invoke-command on several other machines with no issues.

After some digging and with a little help from a co-worker, we realized it was because the remote computer wasn’t listening for WinRM on the default port.

Which as everyone knows the listening port should be 5985!!! Actually I didn’t know that but I do now….here are the default ports for WinRM

The default ports for winrm 1.1 are http port 80 and https port 443
The default ports for winrm 2.x are http port 5985 and https port 5986

Also it is good to note the command I used to list the listening port

winrm enumerate winrm/config/listener

Having gotten this far I decided to change the listening port on that machine, which took me longer to figure out than I care to admit. Anyway, first we need to delete the existing listening port…

WinRM delete winrm/config/listener?Address=*+Transport=HTTP

And Finally adding  the Listener for the default port:

Winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port=”5985″}

I really hope this helps others…

References:

http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/02/23/remotely-managing-your-server-core-using-winrm-and-winrs.aspx

http://www.symantec.com/business/support/index?page=content&id=TECH97514

Categories: Powershell

6 Comments

Kjel · September 13, 2011 at 3:56 am

This helps others 🙂

Thank you

Jay Ervin · October 10, 2012 at 4:23 pm

This article helped me greatly. Anyone know why my WINRM port had been set to 8080? I don’t remember messing with it. After changing to 5985, WINRM, WINRS, and the original Hyper-V problem I was trying to solve began working fine. Thanks!

    C-Rad · October 10, 2012 at 7:12 pm

    I am happy it helped you. I am not sure why it changed, however I think sometimes random apps like to change the ports they and others listen on…

      Krd · July 10, 2013 at 6:51 am

      8080 is the internet port used by TMG for example instead of 80, your proxy uses that port?

        C-Rad · July 16, 2013 at 2:45 pm

        My screenshot was just pointing out the 8080 was Not the port WINRM should be listening on

Krd · July 10, 2013 at 6:49 am

Helps me a lot
thanks!!!

Leave a Reply