
The conversion takes a few minutes to complete on my system. This uses the clonehd command and takes the location of the VirtualBox disk and the path of the vhd to be created. You just need the path to the VirtualBox VM's hard disk. This is a simple one liner using VBoxManage.exe which installs with VirtualBox. VMDK file generated which is what automatically happens when you create a VirtualBox VM. That is all you need to do to get started here. However, if you are interested in this topic, I'm assuming you are able to create a VirtualBox VM. This post will not cover the creation of the image.

I am currently working on another post (hopefully due to publish this week) that will go into detail on creating Windows images with Packer and Boxstarter and cover many gory details around, unattend.xml files, sysprep, and tips to get the image as small as possible. Of course I used Boxstarter to set it all up. Installed VirtualBox, Vagrant, and Packer with Chocolatey.Repaved with Windows 8.1 with Update 1 Professional, fully patched.I'll be running it as a headless VM host. Its video is hosed which is just fine for my purposes.

Well as luck had it, I was able to salvage my daughter's busted old laptop. I have Hyper-V enabled on my personal windows laptop and I needed some "bare metal" to install VirtualBox. You cannot have VirtualBox and Hyper-V comfortably coexist on the same machine.

I will be demonstrating on a Windows box using Powershell scripts but the same can be done on a linux box using bash. This can be entirely done on a machine without Hyper-V installed or enabled. box file that can be used to fire up a functional Hyper-V VM. This post will demonstrate how to automate the conversion of a VirtualBox disk image to a Hyper-V compatible VHD and create a Vagrant. I either have to run through creating the image twice (once for VirtualBox and again for Hyper-V) or I have to copy multi gigabyte files across my computers and then convert them. However it is a major headache to do so especially when preparing Windows images.

I personally use Hyper-V as my hypervisor on windows, but I use VirtualBox on my Ubuntu work laptop so it is convenient for me to create boxes in both formats.
