开发者

CPU Identification on Virtual Machine

I use following c# code to get processor information. The Management class is null if I run my ap开发者_运维知识库plication on a virtual machine. I use Oracle VM VirtualBox as my virtual pc (Windows XP SP3)

System.Management.ManagementClass Management = new System.Management.ManagementClass("Win32_Processor");

Does anyone has experience about using such code and has problems in virtual machines.


Oracle VirtualBox does not provide such information.

Here is the related ticket.

https://www.virtualbox.org/ticket/9046


Are you using GetInstances?

System.Management.ManagementClass ManagementClass1 = new System.Management.ManagementClass("Win32_Processor");

System.Management.ManagementObjectCollection ManagementObjectCollection1 = ManagementClass1.GetInstances();

foreach (System.Management.ManagementObject managementobject in ManagementObjectCollection1) {
    Console.Out.WriteLine(managementobject.Properties["Name"].Value);
}

Console.In.ReadLine();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜