Help Center/ Migration Center/ Best Practices/ Server Migration/ Batch Modifying and Restoring the Host Configurations for Windows Source Servers/ FAQs/ What Can I If an Error Is Reported After a Script Is Executed, Indicating that the Remote Server Fails to Be Connected and the Login Credential Information Is Correct?
Updated on 2024-10-21 GMT+08:00

What Can I If an Error Is Reported After a Script Is Executed, Indicating that the Remote Server Fails to Be Connected and the Login Credential Information Is Correct?

Symptom

After the script was executed, the error message "[ERROR] Failed to update hosts on xxx.xxx.x.xx: [xxx.xxx.x.xx] Failed to connect to the remote server xxx.xxx.x.xx. For details, see the about_Remote_Troubleshooting topic" was displayed.

Possible Causes

The WinRM service on the remote server is not started or is incorrectly configured.

Solution

  1. Check whether the executor can ping the remote server. If the ping operation succeeds, go to step 2.
  2. Check whether port 5985 used by the WinRM service on the remote server is open to the executor. If it is, go to step 3.
  3. Check whether the login credential of the remote server is correct. After confirming that the credential is correct, perform the following steps.
  4. Log in to the remote server that fails to be connected and run PowerShell as administrator.
  5. Run the following command to run the script again:

    Enable-PSRemoting -Force