Set WinRM/Powershell Remoting Port

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

6 Responses to Set WinRM/Powershell Remoting Port

  1. 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!

Leave a Reply