WinRM 客户端收到 HTTP 服务器错误状态 (500)

问题描述 投票:0回答:1

我正在尝试从一个 Windows VM 运行 Powershell 脚本并访问另一个 Windows VM。 但我收到以下错误。我已经验证了几乎所有的论坛并进行了必要的配置,但没有运气。有谁知道如何解决这个错误?

##[error][ABC.domain.com] Connecting to remote server 
ABC.domain.com failed with the following error message : The WinRM 
client received an HTTP server error status (500), but the remote service did 
not include any other information about the cause of the failure. For more 
information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (ABC.domain.com:String) [ 
   ], PSRemotingTransportException
    + FullyQualifiedErrorId : WinRMHttpError,PSSessionStateBroken
windows powershell networking winrm
1个回答
0
投票

我们之所以会出现这种情况,是因为 WinRm 服务配置的证书指纹与我们配置的 https 侦听器的证书指纹不同。

eg 以下两行的指纹不匹配

get-childitem wsman:\localhost\listener | ?{ $_.keys -like '*transport=https*' } | get-childitem
get-Item WSMan:\localhost\Service\CertificateThumbprint

将服务配置指纹设置为空字符串为我们解决了这个问题:

Set-Item WSMan:\localhost\Service\CertificateThumbprint -Value ''

供参考,关于原始错误,除了客户端的500错误之外,服务器系统事件日志中的错误如下:

The WinRM service failed to initialize CredSSP. 

 Additional Data 
 The error received was 0x80338082.

 User Action 
 Configure CertificateThumbprint setting under the WinRM configuration for the service. Use the thumbprint of a valid certificate and make sure that Network Service has access to the private key of the certificate.
© www.soinside.com 2019 - 2024. All rights reserved.