Converting VMware Machine to Hyper-V

As described in a previous post, I have installed MediaWiki on Server 2012 R2 Core. Now I need to convert the machine I built from ESXI to Hyper-V.

I needed to keep the original VM, with its Snapshots, and create a copy of it for a LAB environment. My setup :

  • ESXi (Free) 6.0.0 – Source
  • Server 2012 TP4 with Hyper-V – Destination

Steps I used to copy the VM :

  • Take a Snapshot of the Virtual Machine as a backup
  • We need a machine without snapshots to import into Hyper-V
  • Task Snapshot of functioning machine
  • Run “sysprep /generalize /oobe /shutdown” to generalize the machine and shut it down
  • sysprep

  • Use Vmware converter to convert machine from ESXI format to Workstation format (this will consolidate the snapshots, but leave the original VM untouched)
  • Download and install Microsoft Virtual Machine Converter (I used chocolatey to get MVMC)
  • Once conversion is finished you should have a vmdk and a vmx file in a folder.
  • Using the GUI of Microsoft Virtual Machine Converter it’s not possible to convert this ‘offline’ machine
  • We need to use powershell :
  • Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'
    ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "C:\PathToVMDK\disk.vmdk" -DestinationLiteralPath "C:\DestinationFolder\" -VhdType DynamicHardDisk -VhdFormat Vhdx
    Disable-MvmcSourceVMTools -DestinationLiteralPath "C:\DestinationFolder\disk.vmdk"
  • Now, create a new VM in Hyper-V manager, I used gen 1 as my ESXI machine was using legacy / bios firmware. You may need to use Gen 2 if the original VM was running in UEFI mode.

I was pleasantly surprised by how quick and easy this was – whenever I have tried to do VM conversion in the past its never worked correctly!!