How to get PCIController info with WMI query?
Posted
by smwikipedia
on Stack Overflow
See other posts from Stack Overflow
or by smwikipedia
Published on 2010-03-17T04:30:28Z
Indexed on
2010/03/17
4:41 UTC
Read the original article
Hit count: 532
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.
© Stack Overflow or respective owner