Introduction to WinRM

Sharing is caring!

WinRM provides a command line interface that can be used to perform common management tasks, and also provides a scripting API so you can write your own Windows Scripting Host based scripts. In the background, WinRM relies on management data provided by WMI; however it makes the exchange of data much easier by utilizing the HTTP protocol. It uses SOAP (Simple Object Access Protocol) over HTTP and HTTPS, and thus is considered a firewall-friendly protocol

You must modify the WinRM configuration by running commands on the WinRM host machine. You can use the same machine as both the WinRM service and WinRM client.

Procedure


1. Run the following command to set the default WinRM configuration values.
    c:> winrm quickconfig

2. (Optional) Run the following command to check whether a listener is running, and verify the default ports.
    c:> winrm e winrm/config/listener
The default ports are 5985 for HTTP, and 5986 for HTTPS.

3. Enable basic authentication on the WinRM service.
    a. Run the following command to check whether basic authentication is allowed.
        c:> winrm get winrm/config
    b. Run the following command to enable basic authentication.
       c:> winrm set winrm/config/service/auth @{Basic=”true”}

4. Run the following command to allow transfer of unencrypted data on the WinRM service.
    c:> winrm set winrm/config/service @{AllowUnencrypted=”true”}

5. Enable basic authentication on the WinRM client.
    a. Run the following command to check whether basic authentication is allowed.
        c:> winrm get winrm/config
    b. Run the following command to enable basic authentication.
        c:> winrm set winrm/config/client/auth @{Basic=”true”}

6. Run the following command to allow transfer of unencrypted data on the WinRM client.
    c:> winrm set winrm/config/client @{AllowUnencrypted=”true”}

7. If the WinRM host machine is in an external domain, run the following command to specify the trusted hosts.
      c:> winrm set winrm/config/client @{TrustedHosts=”host1, host2, host3″}

8. Run the following command to test the connection to the WinRM service.
    c:> winrm identify -r:http://winrm_server:5985 -auth:basic -u:user_name -p:password -encoding:utf-8

You might need to install WinRM depending on the operating system as listed in the following table:


Operating System      WinRM
Windows 7                WinRM 2.0 installed by default.
Vista                          WinRM 1.1 installed by default.
Windows XP             WinRM not installed by default







Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.