views:

388

answers:

3

How can I detect if a system supports hardware virtualization via code? (Preferably in C# or C++).

I tried using WMI and ManagementObjectSearcher, and could not find a property that seemed to represent if virtualization support was present or not in the machine.

Bonus question: Is it possible to tell if the CPU supports HW virtualization, but disabled in BIOS?

A: 

Not sure on the code, but Securable seems to be able to do this.

Slipfish
Exactly like this application - but I need to do it in code. I have searched WMI query results high and low and could not find any property that seemed to be connected to HW virtualization
Rajah
+2  A: 

I think the original poster is asking how to detect that the computer hardware supports virtualisation, not that it is running inside a virtual machine. See this question for a possible answer.

Also, it might be worth seeing if you can check the CPU flags, as there will either be the Intel vmx flag or the AMD svm flag if the processor supports virtualisation extensions. I can't say I know how this should be done under Windows, but the information is available in /proc/cpuinfo on Linux.

Dave