[英]WMI Access denied excptn
string s = Form1.ipadd;
string devic;
devic = comboBox1.Text;
groupBox2.Text = devic + " Information";
ConnectionOptions _Options = new ConnectionOptions();
_Options.Username = "Babar";
_Options.Password = "";
ManagementPath _Path = new ManagementPath(s);
ManagementScope _Scope = new ManagementScope(_Path, _Options);
_Scope.Connect();
ManagementObjectSearcher srcd = new ManagementObjectSearcher("select * from "+devic);
tsprogress.Value = 0;
Allplabel.Text = " : 0%";
foreach (ManagementObject obj in srcd.Get())
{
//listBox5.Items.Add(obj.Properties.ToString());
foreach (PropertyData aProperty in obj.Properties)
{
i++;
tsprogress.Value = (i / cont) * 100;
Allplabel.Text = tsprogress.Value.ToString() + "%";
richTextBox1.AppendText(aProperty.Name.ToString() + " : " + aProperty.Value+"\n");
}
}
///////////////////////上面的代码在本地主机上工作正常,但在访问远程系统时不起作用...我将非常感激2您的帮助。
运行此代码的帐户必须在远程计算机上具有足够的访问权限。 请参阅此MSDN页面 。 它还显示了如何使用模拟,这可能是解决问题的一种方式。
这个问题看起来就像您在另一个问题中提出的一样 。 在那里查看我的答案。
布拉马
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.