我正在尝试使用 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-Management 协议的 HTTP 服务器返回