1

我试图使用 WMI 获取一些系统信息,
但问题是当我想获取例如图形卡信息时.. 我有很多驱动程序(真实和虚拟)

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

结果是:
Radmin Mirror Driver v3
ATI Mobility Radeon HD 5650
LogMeIn Mirror Driver
PCI GDIHOOK5

所以我决定编辑查询以仅获取真实的查询。在这种情况下,真实的查询应该具有不等于 null 的 AdapterRam

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());
}

结果是:
ATI Mobility Radeon HD 5650
字节数

有没有更好和更通用的方法来只在 WMI 中获取真正的 adpaters?

4

1 回答 1

0

未找到,因为您仅Name在查询中选择。改用这个:

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

至于第二个问题,我不确定,但您的内存过滤器似乎工作得很好。

于 2012-04-10T07:44:34.563 回答