gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 15:46:49 28 4
gpt4 key购买 nike

我正在尝试使用 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

错误详情:

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

最佳答案

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

关于c# - WinRM 客户端向 HTTP 服务器发送请求,同时在 WinRM 中打开运行空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27798696/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com