用WMI来查询CPU的频率,一直没问题:
"Select MaxClockSpeed From Win32_Processor Where ProcessorType = 3"
结果今天在一台虚拟机上发现无法查询了,于是乎在Powershell里查询了一下
Get-WmiObject –Class Win32_Processor
看看,ProcessorType是空的,Σ( ° △ °|||)︴
坑爹啊,VMWare创建的就没问题,ProcessorType是3.
ProcessorType
- Data type: uint16
- Access type: Read-only
Primary function of the processor.
Value Meaning
- 1 (0x1) Other
- 2 (0x2) Unknown
- 3 (0x3) Central Processor
- 4 (0x4) Math Processor
- 5 (0x5) DSP Processor
- 6 (0x6) Video Processor
参考资料:
http://msdn.microsoft.com/en-us/library/aa394373(v=vs.85).aspx