WINRM – Windows CMD Command

Windows Remote Management

Secure communication with local and remote computers using web services.

WinRM is the Microsoft implementation of WS-Management Protocol, a standard Simple Object Access Protocol (SOAP)-based, firewall-friendly protocol that allows hardware and operating systems, from different vendors, to interoperate.

To improve security, WinRM 2.0 uses HTTP/HTTPS ports 5985/5986 by default.

If the computer name is passed using r:<Computername> , then the default client port will be used (by default, 5985/5986).
If the computer name is passed as a URI, such as r:https://Mycomputer/wsman, then the IE default ports will be used (ports 80/443 by default).



Configure Windows Remote Management on the server (DemoServer2), run this from an elevated CMD (or powershell) prompt:
C:\> winrm quickconfig

On a client you can then open a remote shell connected to DemoServer2 with:
winrs -r:DemoServer2 cmd

Retrieve current configuration in XML format:
winrm get winrm/config -format:pretty

Retrieve spooler instance of Win32_Service class:
winrm get wmicimv2/Win32_Service?Name=spooler

Modify a configuration property of WinRM:
winrm set winrm/config @{MaxEnvelopeSizekb="100"}

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

Add remote machine to the trusted hosts list (used if your computers aren’t on a domain):
winrm set winrm/config/client '@{TrustedHosts="workstation64,server1"}'

Create instance of HTTP Listener on IPv6 address:
winrm create winrm/config/Listener?Address=IP:3ffe:8311:ffff:f2c1::5e61+Transport=HTTP

Delete the HTTP listener on this machine for given IP address:
winrm delete winrm/config/Listener?Address=IP:

Call StartService method on Spooler service:
winrm invoke StartService wmicimv2/Win32_Service?Name=spooler

Call Create method of Win32_Process class with specified parameters:
winrm invoke Create wmicimv2/Win32_Process @{CommandLine="notepad.exe";CurrentDirectory="C:\"}

Display error message associated with the error code 0x5:
winrm helpmsg 0x5

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *