You can configure the WinRM host to enable communication with the PowerShell plug-in through the HTTP protocol.

About this task

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.

Important:

If you skip any of the steps when configuring WinRM to use HTTP, the host might not be added, and you might get an error message in the logs such as

Caused by: org.dom4j.DocumentException: Error on line -1 of document : Premature end of file. 
Nested exception: Premature end of file.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278)
at com.xebialabs.overthere.cifs.winrm.connector.JdkHttpConnector.sendMessage(JdkHttpConnector.java:117)

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.
    1. Run the following command to check whether basic authentication is allowed.

      c:\> winrm get winrm/config/service

    2. 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.
    1. Run the following command to check whether basic authentication is allowed.

      c:\> winrm get winrm/config/client

    2. 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