How do I change Listener port in Powershell/winrm 2.0?

22,795
  1. Open a PowerShell window with administrative privileges.
  2. Run dir WSMan:\localhost\listener\*\Port and check the Value parameter to see what you're currently listening on.
  3. If you'd like to change it, run Set-Item WSMan:\localhost\listener\*\Port 8888

If you'd still like to do it with winrm, you need to modify your command to the following --

winrm set winrm/config/Listener?Address=*+Transport=HTTP '@{Port="8888"}'
Share:
22,795

Related videos on Youtube

Andrew Savinykh
Author by

Andrew Savinykh

Updated on September 18, 2022

Comments

  • Andrew Savinykh
    Andrew Savinykh over 1 year

    In quite a few places the command for changing the port winrm listens on look like this:

    winrm set winrm/config/Listener?Address=*+Transport=HTTP @{Port="8888"}
    

    However this does not work for me. The error I'm getting is:

    Error: Invalid use of command line. Type "winrm -?" for help.
    

    Obviously, internet can't be wrong, so that's me doing something incorrectly. The question is, how to do this correctly?

  • Ryan Ries
    Ryan Ries about 12 years
    You might need to restart the WinRM service afterwards for the change to take effect. +1
  • Talespin_Kit
    Talespin_Kit about 10 years
    does "Set-Item" has any advantage over "winrm set"?
  • wandersick
    wandersick over 4 years
    I believe this Microsoft blog post would supplement this answer nicely by adding more alternatives and client-side configuration blogs.technet.microsoft.com/christwe/2012/06/20/…