Question

Im trying to get some system information using WMI
but the problem is when i want to get for example Graphic Card information .. i get many drivers (real & virtual)

ManagementObjectSearcher searcher = new ManagementObjectSearcher("select Name from " + key);
foreach (ManagementObject share in searcher.Get())
{
   Console.WriteLine(share["Name"].ToString());
}

The result was :
Radmin Mirror Driver v3
ATI Mobility Radeon HD 5650
LogMeIn Mirror Driver
PCI GDIHOOK5

so i decided to edit the query to get only the real one.. in this case the real one should has AdapterRam that doesn't equal to null

ManagementObjectSearcher searcher = new ManagementObjectSearcher("select Name,AdapterRAM from " + key+" where AdapterRAM is not null");
foreach (ManagementObject share in searcher.Get())
{
   Console.WriteLine(share["Name"].ToString());
   Console.WriteLine(share["AdapterRAM"].ToString());
}

The Result was:
ATI Mobility Radeon HD 5650
number of bytes

is there a better and general way to get only the real adpaters in WMI ?

Was it helpful?

Solution

It's not found because you selecting only Name in your query. Use this instead:

"select * from " + key+" where AdapterRAM is not null"

as for second question, I'm not sure, but seems like your memory filter works well enough.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top