WinRM client sent a request to an HTTP server, while opening Runspace in WinRM

谁说胖子不能爱 提交于 2020-01-15 07:05:01

问题


I am trying to access the Remote system service details using powershell System.Management.Automation dll.

When i am executing the below code to connect to the remote system I am facing the error:

Code snippet:

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

Error Details:

The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available. This is usually returned by a HTTP server that does not support the WS-Management protocol


回答1:


I had the same issue, the uri that i used and worked is http://machinename/powershell/ I had also similar error message with basic authentification, so using Kerberos is needed in some cases.



来源:https://stackoverflow.com/questions/27798696/winrm-client-sent-a-request-to-an-http-server-while-opening-runspace-in-winrm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!