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();
精彩评论