积极答复者
使用managementscope连接远程计算机wmi空间

问题
-
在msdn的文档上有以下内容:http://msdn.microsoft.com/zh-cn/library/system.management.managementscope%28v=vs.90%29.aspx
按照此类的示例代码学习测试, 遇到这样的问题:
ConnectionOptions options = new ConnectionOptions(); options.Username="a"; options.Password="123"; options.Authority = "ntdlmdomain:DOMAIN"; // and replace DOMAIN with the remote computer's // domain. You can also use kerberose instead // of ntdlmdomain. // Use this code if you are connecting with a // different user name and password: // ManagementScope scope = new ManagementScope( "\\\\FullComputerName\\root\\cimv2", options); scope.Connect();
如果我设定了scope的options参数, scope.connect()这一句就会出现个invaid Parameter 的异常
我觉得不是权限设置或者scope路径错误的问题 ...用户a的权限密码没有问题...毕竟也不是报拒绝访问的异常
因为试着把options参数取消,连接到远程电脑才会提示权限不足,拒绝访问; 这种情况下把自己加到远程电脑的管理员组里就可以正常访问wmi了
是不是我的连接options.Authority参数没有正确设置? 请大神们指点哪里出了异常...
答案
-
請看以下的網頁有說明
http://msdn.microsoft.com/en-us/library/system.management.managementscope.aspxInvalid Argument SolutionIt is not ntdlmdomain it is ntlmdomain .
Also, it is not kerberose it is kerberos .
Please, change this. Using the current ones you will receive an Invalid Parameter exception.options.Authority = "ntdlmdomain:DOMAIN";
=>
options.Authority = "ntlmdomain:DOMAIN";
亂馬客blog: http://www.dotblogs.com.tw/rainmaker/
- 已标记为答案 幻靈天 2012年2月14日 10:22
全部回复
-
請看以下的網頁有說明
http://msdn.microsoft.com/en-us/library/system.management.managementscope.aspxInvalid Argument SolutionIt is not ntdlmdomain it is ntlmdomain .
Also, it is not kerberose it is kerberos .
Please, change this. Using the current ones you will receive an Invalid Parameter exception.options.Authority = "ntdlmdomain:DOMAIN";
=>
options.Authority = "ntlmdomain:DOMAIN";
亂馬客blog: http://www.dotblogs.com.tw/rainmaker/
- 已标记为答案 幻靈天 2012年2月14日 10:22
-
請看以下的網頁有說明
http://msdn.microsoft.com/en-us/library/system.management.managementscope.aspxInvalid Argument SolutionIt is not ntdlmdomain it is ntlmdomain .
Also, it is not kerberose it is kerberos .
Please, change this. Using the current ones you will receive an Invalid Parameter exception.options.Authority = "ntdlmdomain:DOMAIN";
=>
options.Authority = "ntlmdomain:DOMAIN";
亂馬客blog: http://www.dotblogs.com.tw/rainmaker/
晕。。。怎么示例有错误不更正。。
刚才试了下又遇到的一个问题需要注意。。。
如果scope加上了connectionoption参数 就不要再链接本地计算机,否则也会报错,必须远程计算机
除非你有异常判断。。。