How Do I Configure WinRM and Troubleshoot WinRM Connection Problems?
This section describes how to configure WinRM on a Windows source server and the solutions to connection problems.
Configuring WinRM
- Log in to the source server as an administrator (for example, the administrator account or a local user account in the administrators group).
- For Windows 11, choose Settings > Network & Internet > Ethernet > Properties, and set it to Private. Skip this step for other systems.
- Run PowerShell as administrator.
- Run the following command on PowerShell to start WinRM:
winrm quickconfig Enable-PSRemoting Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
- Log in to the server where the MgC Agent (formerly Edge) is installed as an administrator and run PowerShell as administrator. Perform steps 5 to 7 on the server with the MgC Agent installed.
- Add the source server to the trusted host list. Run the following command on PowerShell to add the source server to the trusted host list:
winrm set winrm/config/client '@{TrustedHosts="*"}'For security purposes, you are advised to use hostname or IP address of the source server to replace the asterisk (*) in the TrustedHosts value. If it is not replaced, any host is trusted.
- Remotely connect to the source server. Run the following command to test the connection to the source server. Replace Login account and Source server IP address with the actual login account and IP address of the source server.
Enter-PSSession -Credential Login account -ComputerName Source server IP address
- In the dialog box that is displayed, enter the username and password for logging in to source server and click OK.
- If the connection is successful, you can run any command to test the interactivity.
- If the connection fails, rectify the fault by referring to WinRM Connection Failure Troubleshooting.
WinRM Connection Failure Troubleshooting
If the remote connection fails, check:
- Port settings: Use telnet to check whether port 5985 on the source server is accessible. If the port is inaccessible, check the firewall or security software settings on the source server to ensure that port 5985 is open.
telnet ip port
- Network settings: Run the following command to check whether the network access model is set to Classic.
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest
- If the value of forceguest is REG_DWORD 0x0, the model is already set to Classic.
- If the value of forceguest is not REG_DWORD 0x0, run the following command to change it:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t reg_dword /d 0x0
- PowerShell system environment variables: Open PowerShell from the Windows Start menu and verify the Powershell system environment variables using the command below:
[Environment]::GetEnvironmentVariable("Path","Machine")If the output does not include C:\Windows\System32;C:\Windows or contains %PATH%, fix it by running the following commands:$fixPath = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\" [Environment]::SetEnvironmentVariable("Path", $fixPath, "Machine")$env:PATH = [Environment]::GetEnvironmentVariable("Path","Machine") - Username and password: Ensure that the username and password entered in the connection command are correct.
The preceding steps can rectify common connection problems. If the problem persists, contact technical support.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot