[英]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.