🇬🇧 | 🇩🇪 | 🇫🇷 | 🇪🇸 | 🇨🇳 | 🇸🇦
我们没有DLL,但我们有:
Windows文件分析器和在线快速反病毒

一个简约的界面,具有快速搜索,方便的上传和干净的部分结构.

🛡️🔍 快速验证你的档案,只需要放上这个页面.
病毒检查,哈希,签名验证,架构,人工智能信息.

如何修复 "The WinRM client cannot process the request because it received an HTML error packet."

描述

This error occurs when you try to establish a remote management session using Windows Remote Management (WinRM) or PowerShell Remoting. It indicates that the WinRM client initiated a connection expecting a valid XML-formatted WS-Management response, but the target server, an intermediate proxy, or a local security application returned a standard web page (HTML) instead.

这通常是因为请求被拦截,重定向或阻止.常见的根源原因包括:


逐步修复问题

您必须运行 PowerShell 或命令提示符作为管理员.

步骤1:绕过本地流量代理

最常见的原因是您的系统试图通过代理服务器发送WinRM流量.

  1. 打开 PowerShell 作为一个管理员.
  2. 通过运行: 检查您当前的WinRM代理设置
    netsh winhttp show proxy
  3. 如果一个代理服务器列出,请检查它是否绕过本地地址.如果没有,或者如果你想在没有它的情况下进行测试,请通过运行暂时重置代理设置:
    netsh winhttp reset proxy
  4. 如果您使用互联网选项代理, 打开 Run 对话 ( Win + R ), 类型 inetcpl.cpl,然后按下 Enter.
  5. 让我们去看看. Connections 按下按. LAN settings.
  6. 检查一个框,上面写着 "Bypass proxy server for local addresses".
  7. 点击 OK 然后点击 Apply.

步骤2:重新启动并快速配置WinRM服务

更新服务文件和检查收听器可以修复配置错误.

  1. 打开 PowerShell 作为一个管理员.
  2. 重新启动 WinRM 服务以清除暂时故障:
    Restart-Service WinRM
  3. 运行自动配置工具来修复收听器和防火墙规则:
    winrm quickconfig
  4. 按下 Y (是的) 如果被要求做出改变或创造听众.

第三步:检查港口冲突情况

如果另一个应用程序使用端口5985,WinRM将失败,并返回来自冲突应用程序的HTML数据.

  1. 打开 Command Prompt 或是 PowerShell 作为一个管理员.
  2. 检查哪个进程在默认的WinRM HTTP端口 (5985) 上听:
    netstat -ano | findstr :5985
  3. 注意过程标识符 (PID),这是输出行右边的数字.
  4. 通过运行 (取代) 检查哪个应用程序拥有该PID YOUR_PID 实际数量:
    tasklist /fi "pid eq YOUR_PID"
  5. 如果申请是其他东西, System 或是 wsmprovhost.exe, you must stop that conflicting application or change its port configuration.

步骤4:将目的地添加到可信托主机列表中

如果您正在连接到您主动目录域之外的远程机器,则客户机将拒绝连接,除非目标被明确信任.

  1. 打开 PowerShell 作为一个管理员.
  2. 运行下面的命令来信任特定的目标计算机 (取代 IP_OR_NAME 有远程机器的IP地址或主机名):
    Set-Item WSMan:\localhost\Client\TrustedHosts -Value "IP_OR_NAME" -Force

    注意:您可以使用 ` as the value to trust all hosts for testing purposes, though this is not recommended for permanent production use due to security risks.*

  3. 重新启动 WinRM 服务,以应用更改:
    Restart-Service WinRM

步骤5:验证SPN (服务主体名称) 设置

如果您处于域环境中,如果SPN缺失或复制,Kerberos身份验证可能会失败.

  1. 打开 Command Prompt 作为一个管理员.
  2. Test if the Service Principal Name is registered correctly for the target computer by running (replace TARGET_COMPUTER_NAME 您试图访问的服务器名称):
    setspn -L TARGET_COMPUTER_NAME
  3. 寻找以 开始的条目. WSMAN/. If they are missing, you may need to register them or contact your network domain administrator to sync the Active Directory objects.
ERROR_WSMAN_HTTP_STATUS_BAD_REQUEST | ERROR_WSMAN_CONFIG_CANNOT_CHANGE_CERTMAPPING_KEYS | ERROR_WSMAN_PLUGIN_CONFIGURATION_CORRUPTED | ERROR_WSMAN_INVALID_FILEPATH | ERROR_WSMAN_FILE_NOT_PRESENT

可能有一些错误.. Learn Microsoft