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

About this task

The WinRM host requires a certificate so that it can communicate through the HTTPS protocol. You can either obtain a certificate or generate one. For example, you can generate a self-signed certificate by using the Certificate Creation tool (makecert.exe) that is part of the .NET Framework SDK.

Prerequisites

  • Configure WinRM to use the HTTP protocol. For more information, see Configure WinRM to Use HTTP.

  • Verify that you can access the Microsoft Management Console (mmc.exe) on the WinRM host.

Procedure

  1. Generate a self-signed certificate.

    The following command line contains example syntax for creating a certificate on the WinRM host by using makecert.exe.

    makecert.exe -r -pe -n "CN=host_name-3,O=organization_name" -e mm/dd/yyyy -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 certificate_name.cer

  2. Add the generated certificate by using the Microsoft Management Console.
    1. Run mmc.exe.
    2. Select File > Add/Remove Snap-in.
    3. From the list of available snap-ins, select Certificates and click Add.
    4. Select Computer account and click Next.
    5. Click Finish.
    6. Verify that the certificate is installed in Console Root > Certificates (Local Computer) > Personal > Certificates and Console Root > Certificates (Local Computer) > Trusted Root Certification Authorities > Certificates.

      If the certificate is not installed in the Trusted Root Certification Authorities and Personal folders, you must install it manually.

  3. Create an HTTPS listener by using the correct thumbprint and host name.

    The following command line contains example syntax for creating an HTTPS listener.

    winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="host_name";CertificateThumbprint="certificate_thumbprint"}

  4. Test the connection.

    The following command line contains example syntax for testing the connection.

    winrs -r:https://host_name:port_number -u:user_name -p:password hostname