Hyper-V is used by Visual Studio to run Windows Phone emulators. Hyper-V is also incompatible with VMware, since Hyper-V starts Windows in virtual virtualization mode, while VMware also needs VT-x at run time.
Hyper-V can be installed and uninstalled as a Windows role. It also activates and deactivates persistent Windows virtualization and allows you to start VMware. But then, of course, Visual Studio emulators stop working.
Hyper-V can be configured as active or inactive without removing the Windows role. This includes editing the boot configuration using bcdedit.exe. After this change, a reboot is required to actually apply the configuration and to use or not to use Hyper-V. This BCD parameter can be read after installing it, but it is not known whether the system has already been restarted to apply it. Thus, this parameter only indicates what will happen after the restart, and if virtualization will not be currently running.
Some people say that you can see the Windows service "vmms". Unfortunately, this is not useful because this service is installed with the Hyper-V role and it always works, regardless of whether virtualization is really active or not. WMI information also does not help, as it always says that Hyper-V will work, even if it is not.
Obviously, there must be a way to determine the actual current status of virtualization, because VMware will tell you when you try to start a 64-bit machine.
So how can this be done in code? In particular, from a .NET application? Administrator rights are available for this, since bcdedit.exe also needs this.
If this requires native assembler code, is it possible to run it from C # /. NET in some way?
Update:
I made a simple tool that placed one click on the bcdedit procedure: Hyper-V Switch . You can try and make sure that at the moment you find some reliable indicator of Hyper-V operation, and not just configured to start at the next boot. Enable or disable Hyper-V, but do not open an application that prevents a reboot. Then Hyper-V Switch will tell you the configured state, not the actual state.
In the end, I would like to include this status test in the application so that everyone can use it.