我正在使用WMI。我想訪問遠程系統信息。下面的代碼工作環回或本地主機上,但是當我試圖訪問遠程計算機出現下面的異常錯誤:「訪問被拒絕」WMI異常
Access is denied. (Exception from HRESULT:0X8005(E_ACCESSDENIED))
當開關2個系統之間使用。
和
The RPC server Is unavailable. (Exception from HRESULT: 0x800706BA)
當兩個系統是直接連接。在兩個系統上
OS:Windows服務包2.
防火牆=阻塞。
遠程過程服務=正在運行。
工具:.NET Visual Studio 2008的C#
代碼:
try
{
ConnectionOptions _Options = new ConnectionOptions();
ManagementPath _Path = new ManagementPath(s);
ManagementScope _Scope = new ManagementScope(_Path, _Options);
_Scope.Connect();
ManagementObjectSearcher srcd = new ManagementObjectSearcher("select * from Win32_DisplayConfiguration");
foreach (ManagementObject obj in srcd.Get())
{
//listBox5.Items.Add(obj.Properties.ToString());
foreach (PropertyData aProperty in obj.Properties)
{
listBox1.Items.Add(aProperty.Name.ToString() + " : " + aProperty.Value);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
@dtb:感謝您的編輯。由於編輯使他們不再相關,我清除了評論並關閉了投票。 – 2009-12-12 21:26:32
關於它的任何解決方案? – Kiquenet 2012-02-10 12:30:42