1

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 ?

Murhaf Sousli
  • 12,622
  • 20
  • 119
  • 185

1 Answers1

0

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.

Petr Abdulin
  • 33,883
  • 9
  • 62
  • 96
  • im really sorry .. my fault .. i edited my question .. just want a general way that returns the real drivers only – Murhaf Sousli Apr 10 '12 at 07:47
  • Still, answer is the same. I think AdapterRAM is quite good filtering option, so you can stick with it and time will tell. I don't see any property that will give you 100% guarantee. – Petr Abdulin Apr 10 '12 at 08:00