0
我使用下面的代碼,以獲取有關我的PCIController如何使用WMI查詢獲取PCIController信息?
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from Win32_PCIController");
foreach (ManagementObject cdrom in searcher.Get())
{
Console.WriteLine("PCIController Name: {0}", cdrom.GetPropertyValue("Caption"));
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
一些信息,但它一直扔「無效類」異常。而且我使用隨Windows安裝的「wbemtest.exe」工具運行我的查詢,並且出現同樣的錯誤。我在MSDN上檢查了CIM_PCIController Class,看來我的代碼沒問題。但爲什麼「無效類例外」?有人可以幫助我,我只想從我的PCI控制器設備獲取一些信息。
非常感謝。