
# 执行脚本后报错：连接到远程服务器失败，且登录凭证信息正确
#### 问题现象
执行脚本后报错，错误信息为"\[ERROR\] Failed to update hosts on xxx.xxx.x.xx: \[xxx.xxx.x.xx\] 连接到远程服务器 xxx.xxx.x.xx 失败有关详细信息，请参阅 about_Remote_Troubleshooting 帮助主题"。
#### 问题分析
出现该报错是因为：远程服务器的WinRM服务未启动或者配置不正确。
#### 解决方法
1. 验证执行机能否 ping 通远程服务器。如果可以ping通，请执行步骤2。
2. 确认远程服务器的 WinRM 服务5985端口是否已对执行机开放。确认开放请执行步骤3。
3. 检查远程服务器的登录凭证是否正确。确认凭证正确无误后，请执行后续步骤。
4. 登录连接失败的远程服务器，以管理员身份打开 PowerShell。
5. 执行如下命令，然后重新执行脚本。 
   ```
   Enable-PSRemoting -Force
   ```
   
   
 
