Move VirtualBox VM to Hyper-V

Step by step I create a new HomeLab environment to be up to date with the new cool technical staff and can play around without any issues in a business environment. Most time I use cloud services in my environment but in some cases, I need a local virtual machine like a small domain controller or an Azure AD Connect service.

In the last years, I used VirtualBox from Oracle. Since Windows 10 and the possibility of Hyper-V I make the decision to change my virtualization software.

Install Hyper-V

Installing the hyper-v is very easy. You only need to activate it in program & features at your windows client:

Control Panel -> programs & features -> Activate or Disable Windows Feature

2020-04-15 17_15_15-Edit Post ‹ Martin Alter — WordPress.com and 6 more pages - Microsoft Konto - Mi

After a reboot, you can use the Hyper-V environment

 

Move VirtualBox to Hyper-V

The challenge is there are no directs ways to export the Virtual Box image and import it in Hyper-V. The reason is, VirtualBox use another disk format like Hyper-V:

Hyper-V – VHDX

Virtual Box – VDI 

Convert virtual disks (VDI)

To convert the Virtual Box disk from VDO to VHDX we use the VBoxManage.exe and the Convert-VDH CMDlet

Run the following commands in PowerShell:

#change into VirtualBox directory

cd ‘C:\Program Files\Oracle\VirtualBox\’

#change into VirtualBox directory

cd ‘C:\Program Files\Oracle\VirtualBox\’

#convert to VHD 

.\VBoxManage.exe clonemedium “<path to vdi>\WindowsDomainColtroller.vdi” “<path to store vdh>\WindowsDomainColtroller.vhd” –format VHD

#convert to VHDX

cd <path to store vdh>

Convert-VHD -Path .\WindowsDomainColtroller.vhd -DestinationPath .\WindowsDomainColtroller.vhdx

Import the new Virtual Disk

After we have converted the disk we can import the disk in Hyper-V and use all data in virtual machine:

2020-04-15 20_59_01-Edit Post ‹ Martin Alter — WordPress.com and 9 more pages - Microsoft Konto - Mi

Aso you can use PowerShell to create a new machine

New-VM -Name DomainController -path <path you store VW> –MemoryStartupBytes 2048MB

Add-VMHardDiskDrive -VMName DomainController -path “<path to store vdh>\WindowsDomainColtroller.vhdx”

Start-VM -Name DomainController

 

 

I hope you like this short overview and I had the chance to help 🙂

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s