If the computer does not use a publicly signed certificate, you need to perform some additional steps.
If you are using a Windows version older than Windows 8/Windows Server 2012, you need to create a certificate on a separate, newer computer and then export the certificate to a file. Use the following commands to do this:
$cert = New-SelfSignedCertificate -CertstoreLocation ^
Cert:\LocalMachine\My -DnsName “{ipAddress}”
$password = ConvertTo-SecureString -String “{password}” -Force ^
-AsPlainText
Export-PfxCertificate -Cert $cert -FilePath “{filePath}” -Password ^
$password
Note: Use the IP address of the target computer.
To set up the remote management configuration on a computer that does not use a publicly signed certificate, do all the following steps on the target Windows computer using PowerShell:
-
- Start the WinRM service and set it to start automatically:
Set-Service -Name “WinRM” -StartupType Automatic -Status Running
-
- Generate a new self-signed certificate:
For Windows 8/Windows Server 2012 and newer systems:
-
- Use the following PowerShell command to create the certificate:
$Cert = New-SelfSignedCertificate -CertstoreLocation ^
Cert:\LocalMachine\My -DnsName “{ipAddress}”
-
- Use the following command to check the certificate’s thumbprint, which you need when creating the WSMan HTTPS listener:
$cert.Thumbprint
For older Windows OS versions, copy the previously exported certificate to the target computer and import it to a Personal certificate store:
Note: To view certificates in the local machine store, you must use administrator privileges.
- Type mmc and press Enter.
- Select File > Add/Remove Snap In.
- In the Available snap-ins dialog box, select Certificates.
- Click Add.
- In the Certificates snap-in dialog box, select Computer account and then click Next.
- In the Select Computer dialog box, click Finish.
- In the Add/Remove Snap-in dialog box, click OK.
- Select Certificates (Local Computer) > Personal, right-click and select All Tasks > Import.
- Browse for the copied certificate, then click Next.
- Enter the password for the certificate, then click Next.
- Click Finish.
-
- Add a new WSMan HTTPS listener:
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * ^
-CertificateThumbPrint $Cert.Thumbprint –Force
-
- Add a new firewall rule to allow WinRM HTTPS traffic:
For Windows 8/Windows Server 2012 and newer systems, use the following PowerShell command to create the firewall rule:
New-NetFirewallRule -DisplayName “Windows Remote Management ^
(HTTPS-In)” -Name “Windows Remote Management (HTTPS-In)” -Profile ^
Any -LocalPort 5986 -Protocol TCP
For older Windows OS versions:
- Go to Control Panel > Windows Firewall > Advanced settings.
- Add a new rule for inbound traffic that allows TCP port 5986 for the selected network profiles.
-
- If you are using Linux scan nodes, run the following PowerShell command on the target Windows computer to allow basic WinRM authentication:
winrm set winrm/config/service/auth ‘@{Basic=”true”}’