Blog.

Switch between Hyper-V and Virtualbox on Windows

MF

Marco Franssen /

5 min read988 words

Cover Image for Switch between Hyper-V and Virtualbox on Windows

Since a while I have been using Virtualbox + vagrant to do web development based on Linux, Nginx and NodeJS. However I also still do Windows development occasionally. For that reason I needed a way to easily switch from Virtualbox to Hyper-V or the other way around, as Hyper-V is required for example for the Windows Phone emulator.

Hyper-V can not run together with Virtualbox as they both need an Hypervisor. Unfortunately you can't have 2 Hypervisors running. Therefore we need to disable Hyper-V when we want to use Virtualbox. Unfortunatily you simply can't just disable Hyper-V.

What I wanted to achieve was the following:

  • Being able to use vagrant and virtualbox to do my webserver development on my Linux VM's.
  • Being able to use the Windows Phone emulator using Hyper-V to do my Windows Phone development.

Basically some webpages out there advice you to disable Hyper-V by using the Add/Remove Features. However if we do that we have to reinstall it when we need it again. So for me that wasn't really a solution. The other solution is to have multiple boot profiles on Windows, so you can pick which one to use when booting your computer. As it is not the ideal solution, since you have to reboot your computer to switch, it is the only solution today.

As we are going to modify our boot loader I want you to pay extra attention as we don't want to end with our computer in a corrupted state. When not comfortable, please consult a local expert to help you on the topic. First of all we create a backup of the boot manager using the /export option. Make sure you are running from an elevated (administrator) Command prompt.

bcdedit /export backup.bcd

If you feel you have messed up somewhere in the process, restore the original settings from your backup. The backup is located in the directory where you started the export.

bcdedit /import backup.bcd

To create a second boot profile you can execute following command.

Command-prompt
$ bcdedit /copy {current} /d "Windows 10 No Hyper-V"
The entry was successfully copied to {058c531b-e643-11e3-81ef-ecf4bb2c6815}.
 
$ bcdedit /set {058c531b-e643-11e3-81ef-ecf4bb2c6815} hypervisorlaunchtype off
The operation completed successfully.

The first commands copies the current boot profile to a new one named Windows 10 No Hyper-V. The second command disables Hyper-V on this copy of the boot profile. Please note we are using the ID of the profile to set this option, it might differ on your side, when creating the copy.

What this basically gives us is a dual boot system where you can pick from the following options (blue window at boot):

  • Windows 10
  • Windows 10 No Hyper-V

This window gives you a few seconds to make your choice. When you didn't make a choice it will pick the default which is in our case Windows 10.

You can also use the tool bcdedit to check your boot profiles using following command.

command-prompt
$ bcdedit /enum
 
Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
integrityservices       Enable
default                 {current}
resumeobject            {058c531a-e643-11e3-81ef-ecf4bb2c6815}
displayorder            {058c531b-e643-11e3-81ef-ecf4bb2c6815}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 30
 
Windows Boot Loader
-------------------
...
.....
...

For brevity I left the details of my boot loaders. In your case it should show 1 Windows Boot Manager and 2 Windows Boot Loaders. As you can see the boot manager also has a default configured. In my case I decided to make my Windows 10 No Hyper-V the default as I'm using Virtualbox more often. To do so you can run following command to configure this boot loader as default. Make sure you pick the right ID.

bcdedit /default {058c531b-e643-11e3-81ef-ecf4bb2c6815}

I also decided to change the order of the entries in the boot manager so it shows the Windows 10 No Hyper-V option first and the Windows 10 option second.

bcdedit /displayorder {058c531a-e643-11e3-81ef-ecf4bb2c6815} {otherid}

The timeout by default is 30 seconds, which gives you plenty of time to make your choice. I figured that when I configured my default I barely have to switch the choice. In that case I don't want to wait 30 seconds for my computer to pick that default. So then I still have to hit enter to not be waiting for this timeout to expire. No big deal right? However waiting for this boot screen also takes a few seconds, and I don't want to wait for that either. I just want to press the power button and then immediately head out for the coffee machine as any developer would obviously do ;-). As I don't want to delay the process of booting for 30 seconds I just decreased the timeout to 10 seconds. It still gives me enough time to make a choice when the default is not suitable, but it doesn't delay to much when I'm not waiting for the boot loader to make the choice myself. This basically leaves me with a booted machine when I take an espresso at the coffee machine instead of a lungo ;-).

bcdedit /timeout 10

There are many more neat tricks you can achieve with bcdedit. Please use following command(s) to figure out more about how to use bcdedit.

bcdedit /?
bcdedit /export /?

The first command gives you the global help of bcdedit. The second command gives you some more detailed help on the /export option. I guess I don't have to explain you can get more details about other commands in a similar way.

I hope this blog post was useful for you, and you didn't end up with a corrupted Boot loader. Please let me know if you have any valuable additions which I can include in this blog post, by leaving me a comment below.

You have disabled cookies. To leave me a comment please allow cookies at functionality level.

More Stories

Cover Image for From errbacks to Promises in Node

From errbacks to Promises in Node

MF

Marco Franssen /

In javascript world many APIs and libraries require you to implement most logic using callbacks. As of ES6, also referred to as ES2015, we can use the native Promise API. In most modern browsers and the current releases of Node.js the Promise API is supported. This enables us to use Promises without any thirdparty libraries. In Node.js we all know most of the libraries or built-in components are using callbacks. Those callbacks all have the same method signature, also referred to as errbacks. A…

Cover Image for Ssl certificate for your Azure website using Letsencrypt

Ssl certificate for your Azure website using Letsencrypt

MF

Marco Franssen /

Letsencrypt is a free automated service which provides you SSL certificates for free. Although the certificates are only valid for 3 months, this shouldn't be a bottleneck as you can fully automate the certificate request and renewal. Letsencrypt comes with a python client which you can use to make a certificate request. Letsencrypt can be ran from a Linux OS. In this blogpost I will show you how to use the Letsencrypt Vagrant box (Ubuntu vm) to authorize the certification request for your Azur…

Cover Image for Jasmine vs. Mocha

Jasmine vs. Mocha

MF

Marco Franssen /

In this blog post I want to highlight the similarities and the differences between Jasmine and Mocha. In this comparison I will focus on the latest versions of both libraries. As of this writing Jasmine 2.4 and Mocha 2.3. When comparing both libraries at NPMCompare you notice that Mocha is the more popular framework today. Mocha has more frequent updates, more downloads and more forks on Github. Although both frameworks are pretty popular and do have a lot of similarities. Lets go have a look a…

Cover Image for Put your ssh experience in Windows on Steroids

Put your ssh experience in Windows on Steroids

MF

Marco Franssen /

In this blogpost I want to show you how you can make your life easier to work with Linux VM's and Git by configuring SSH on your Windows Machine in a secure but convenient way. Let me first elaborate a little further why you would want to apply the tips and tricks from this blog post. Git has become the de-facto standard of vcs over the past few years. You are probably using it for all your software development projects, and maybe even for your web blog, when you are blogging in markdown using…