Use Hyper-V and VirtualBox together on Server 2019

I stumbled across this while trying to get Multipass working on Server 2019, with Hyper-V. My plan is to use Multipass to quickly spin up virtual machines for different blog posts I plan on doing. There is a known issue with Multipass using Hyper-V, so I decided to try it with Oracle VirtualBox instead.

With VirtualBox 6.0 you can now install it along side the Hyper-V hypervisor, but you will encounter the error below if you try to start any virtual machine in Virtual Box.

VBoxManage.exe: error: WHvCapabilityCodeHypervisorPresent is FALSE! Make sure you have enabled the 'Windows Hypervisor Platform' feature. (VERR_NEM_NOT_AVAILABLE).

If you are using a version of Windows that is not Server 2019, you can easily enable the 'Windows Hypervisor Platform' feature, and be on your way. If you are using Windows Server 2019, this feature does not exist in the Server Manager UI, so you have to add it manually.

Enable using PowerShell as Administrator

Enable-WindowsOptionalFeature -FeatureName "HypervisorPlatform" -Online

Enable using Command-line as Administrator

Dism /Online /Enable-Feature:HypervisorPlatform