【问题标题】:Remote Connection using Management Scope?使用管理范围的远程连接?
【发布时间】:2014-08-07 09:59:57
【问题描述】:

我正在尝试在 Management Scope 的帮助下从我的本地计算机连接远程系统。

我尝试的是:

我的代码如下,

 ConnectionOptions con= new ConnectionOptions();
 con.Username = strUsername;
 con.Password = strPassword;
 con.Impersonation = ImpersonationLevel.Impersonate;
 con.EnablePrivileges = true;
 ManagementScope ManagementScope1 = new ManagementScope(string.Format("\\\\{0}\\root\\cimv2", strIP), con);
 ManagementScope1.Connect();

我的问题是:

使用上面的代码,当远程系统有用户名和密码时,我可以连接远程系统。(strUsername = "User", strPassword="Welcome")

但如果密码为空 (strUsername = "User", strPassword = "") ,则会收到名为“Access is Denied”的错误。连接的远程系统没有密码保护

远程系统用户授予了访问机器的各种权限,但仍然面临这个奇怪的问题。

请告诉我哪里出错了。任何帮助深表感谢。提前致谢。

【问题讨论】:

  • 您是否尝试过以管理员身份使用您的应用程序?
  • 是的,我仅以管理员身份工作和运行我的应用程序。

标签: c# networking system remote-access


【解决方案1】:

如果你想使用当前登录的用户访问远程 WMI,你必须传递 null 作为用户名。

如果连接将使用当前登录的用户,则为空;否则,表示用户名的字符串。默认值为空。

来源:http://msdn.microsoft.com/en-US/library/system.management.connectionoptions.username(v=vs.110).aspx

【讨论】:

  • 本地机器和远程机器通过WMI连接成功。并且用户名可用于远程机器,而密码为空。我也通过了 null,仍然面临同样的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-05
  • 1970-01-01
相关资源
最近更新 更多