关于C#中用WMI获取系统信息问题

来源:互联网 发布:mysql use near 编辑:程序博客网 时间:2024/06/03 00:15

比如:Win32_Processor——CPU 处理器
用:    

string strCpu = null;        ManagementClass myCpu = new ManagementClass("win32_Processor");        ManagementObjectCollection myCpuConnection = myCpu.GetInstances();        foreach (ManagementObject myObject in myCpuConnection)        {            strCpu = myObject.Properties["Processorid"].Value.ToString();            break;        }        return strCpu;

可以取出第一个cpu的CPU的序列号。现在我知道它有"Processorid"这个属性可以去取
但是还有很多我不知道的属性

我就是想知道怎么查看其他属性叫什么名字?干什么用的?

我应该用什么方法查询?
或者有什么文献~

谢谢大家提点~


 

你可以把每个属性输出来,看看

PropertyDataCollection properties =
            myCpu .Properties;

foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);

}

参照下这里
http://technet.microsoft.com/zh-cn/office/system.management.managementobject_members(VS.85).aspx


 

你好!
     这里有一个列表:
http://hi.baidu.com/lishengmao/blog/item/86654d4f890e6330aec3ab63.html
     希望对你有帮助!


 

你好!


这个示例是目前比较全的获取硬件信息的例子:http://www.codeproject.com/KB/system/GetHardwareInformation.aspx

Win32_Processor Class
http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx

谢谢大家的回复~
我已经知道了

虽然几位版主说的不是我要的直接答案~
但是也给了我帮助~谢谢~