WinRM 客户端向 HTTP 服务器发送了请求,同时在 WinRM 中打开了运行空间



我正在尝试使用Powershell System.Management.Automation dll访问远程系统服务详细信息。

当我执行以下代码以连接到远程系统时,我遇到错误:

代码片段:

string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell";
PSCredential remoteCredential = new PSCredential("uname", this.convertToSecureString("password"));
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://machinename/powershell"), shellUri, remoteCredential);
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo);
runspace.Open();//Here Exception raised

错误详细信息:

WinRM 客户端向 HTTP 服务器发送请求并获得响应 说请求的 HTTP URL 不可用。这通常是 由不支持 WS 管理的 HTTP 服务器返回 协议

我遇到了同样的问题,我使用和工作的 uri 是 http://machinename/powershell/我在基本身份验证方面也有类似的错误消息,因此在某些情况下需要使用 Kerberos。

最新更新