当我尝试使用以下代码连接到远程集群时出现访问被拒绝错误。我想在代码中不提供用户名/密码的情况下建立连接。我将它们存储在 Windows 凭据管理器中。这在我在代码中提供用户名和密码时有效。我应该如何让它从凭证管理器中读取?
ConnectionOptions Options = new ConnectionOptions();
//String Domain = "mydomain";
String Domain = "";
//Options.Username = "administrator";
//Options.Password = "mypassword";
Options.Authority = "ntlmdomain:" + Domain;
Options.Authentication = AuthenticationLevel.PacketPrivacy;
ManagementScope Scope = new ManagementScope(@"\\win2012cluster\root\cimv2", Options);
Scope.Connect();