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");
}
}
///////////////////////// 上面的代码在本地主机上工作正常但在访问远程系统时不起作用......访问被拒绝的删除...我将非常感谢你的帮助。
答案 0 :(得分:1)
运行此代码的帐户必须在远程计算机上具有足够的访问权限。见this MSDN page。它还显示了如何使用模拟,这可能是解决问题的一种方法。
答案 1 :(得分:0)
问题看起来是一样的,你在another question中要求的。在那里看到我的答案。
BR - mabra