Quando executar o comando winrm set -?
, posso ver o seguinte exemplo de como desativar um ouvinte:
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"}
No entanto, quando executo exatamente o mesmo comando em cmd
, como sugerido acima, recebo o erro:
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.
E no PS eu tenho erro diferente:
PS C:\Users\Administrator> winrm set winrm/config/Listener?Address=*+Transport=HTTPS @{Enabled="false"}
Error: Invalid use of command line. Type "winrm -?" for help.
O serviço está em execução ( test-wsman
no PS é executado corretamente):
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
O que estou perdendo? Como posso executar o exemplo acima com sucesso?