Programatically detect if VT-x or AMD-v is enabled on Windows

virtualization, windows

Solution

I believe the best bet to check if virtualisation is enabled is by using WMI and check the Win32_Processor class. The value of the "VirtualizationFirmwareEnabled" field should give you if it is enabled.

I have tested on my machine by enabling and disabling in the BIOS and this value appears correct.

Win32_Processor: http://msdn.microsoft.com/en-us/library/aa394373%28v=vs.85%29.aspx

For checking what is supported I believe you will need to use the __cpuid() intrinsic function with an Information type of 0x1 and 0x80000001 to query the CPU features. Examples can be found on the following links.

CPUID Wiki: http://en.wikipedia.org/wiki/CPUID

__cpuid Function: msdn.microsoft.com/en-us/library/hskdteyh(VS.80).aspx

Problem

On OSX or linux, it is rather trivial to view CPU capabilities in the terminal. Is there a way to access the CPU information, specifically the hardware assisted virtualization capabilities, on Windows? I only found Microsoft's tool: http://www.microsoft.com/en-us/download/details.aspx?id=592 but would like something that doesn't require additional binaries.

Original source