1

When run winrm set -? command, I can see the following example how to disable a listener:

C:\Users\Administrator>winrm set -?
Windows Remote Management Command Line Tool

winrm set RESOURCE_URI [-SWITCH:VALUE [-SWITCH:VALUE] ...]
          [@{KEY="VALUE"[;KEY="VALUE"]}]
          [-file:VALUE]

Modifies settings in RESOURCE_URI using specified switches
and input of changed values via key-value pairs or updated
object via an input file.

Example: Disable a listener on this machine:
  winrm set winrm/config/Listener?Address=*+Transport=HTTPS @{Enabled="false"}

However, when I run exactly the same command in cmd as suggested above, I've got the error:

C:\Users\Administrator>winrm set winrm/config/Listener?Address=*+Transport=HTTPS @{Enabled="false"}
WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the request. The service cannot find the resource identified by the resource URI and selectors.

Error number:  -2144108544 0x80338000
The WS-Management service cannot process the request. The service cannot find the resource identified by the resource URI and selectors.

And in PS I've got different error:

PS C:\Users\Administrator> winrm set winrm/config/Listener?Address=*+Transport=HTTPS @{Enabled="false"}
Error: Invalid use of command line. Type "winrm -?" for help.

The service is up and running (test-wsman in PS runs fine):

C:\Users\Administrator>winrm e winrm/config/Listener
Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 10.152.26.30, 127.0.0.1, ::1,fe80::5efe:10.152.26.30%14, fe80::f9c5:141f:ff25:6253%12

What am I missing? How can I run the above example successfully?

0

The command failed, because Transport is set to HTTP, not HTTPS, that's why selector Transport=HTTPS failed to find the existing resource.

So the command should be:

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

The command should be executed in a Command Prompt (cmd.exe) as it fails in PS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.