How to get PCIController info with WMI query?
- by smwikipedia
I am using the following code to get some info about my 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);
}
But it kept throwing "Invalid Class" exception. And I run my query with "wbemtest.exe" tool which is installed with Windows, and the same error there is. I checked the CIM_PCIController Class on MSDN and it seems my code is ok. But why the "Invalid Class exception"? Could someone help me, I just want to get some info from my PCI Controller device.
Many thanks.