From the #datacenter: Converting #VMware to Hyper-V got even easier!

By | June 11, 2014

If you’re new to the whole VMware to Hyper-V game, you might not be aware of several tools that exist to make converting VMware virtual machines (and their components) to Hyper-V as easy as 1-2-3.

Microsoft has recently released the latest version (2.0) of it’s excellent Virtual Machine Converter tool that makes conversion of VMware guests to Hyper-V guests a cinch.

I’m not going to duplicate the material that exists all over the web about how to perform live conversions of running VMware guests (p.s. it’s awesome and works 99% of the time) as I’m more interested in the disk options associated to the conversion of VMware VMDK’s into both Hyper-V and Azure ready disk images that can then be attached to virtual machines either on-premises on a Hyper-V host or in the Cloud on an Azure VM.

In this first post of a 2-post series (ahem!) we can start off easy and look at converting a VMware VMDK to a Hyper-V ready VHD/VHDX.

Let’s assume you’ve installed the converter (download from http://www.microsoft.com/en-gb/download/details.aspx?id=42497) and that the installation went fine.

Part of the installation is a bunch of PowerShell cmdlets that make interacting with the converter super slick for those of us loving the predictable, repeatable juju of PowerShell.

If we take a peek in the folder where the converter was installed, we can see a PoSh module ready for us to use, so let’s load it!

Uh-oh! An error.

moduleerror

 

 

We’ve been caught out by the fact that the module is not in the module path. No problemo, PowerShell can rescue us.

Here’s a little helper script I knocked together – it will only move the module to the core PSModulePath location so if this is an issue for you, then alter it to meet your needs…

Once run, you can import the module happily straight from the shell and even use a little Get-Command fu to find out what we can do from here:

shell fu

 

 

 

Now we’re good to go to actually perform a conversion…

Let’s use ConvertTo-MvmcVhd to convert our VMDK to a VHD/VHDX

Syntax is simple:

Switches:

-sourceliteralpath is the full path to the source VMDK (inc. filename)

-destinationliteralpath is the full path to the destination VHD/VHDX (inc. filename)

-vhdtype lets us choose Dynamic or Fixed converting dynamic to fixed or leaving as dynamic as required

-vhdformat lets us choose between VHD (older type) and VHDX (newer type) if you have Hyper-V 3 or later you can use VHDX

Let’s give it a spin:

Things to note:

  • Give it a while, especially if your source VMDK is large, the cmdlet uses a nice Write-Progress to give us console output on the conversion so all you have to do is let it marinade
  • Once converted, attach to a Hyper-V VM and let ‘er rip!
    • it helps if the new guest config closely matches the source config (i.e. network interfaces, etc.)
  • You’ll need to uninstall VMtools and add integration services

I’ve used the tool on a bunch of VMware disks now, some of which were quite old (I’ve been using Hyper-V for a while but did have some older legacy VMware images) and have had 99% success. To the best of my knowledge, the one failure I have had was caused by a corrupt source VMDK, not many options here.

In a future post, we’ll walk through a conversion to an Azure disk that can be directly sent to an Azure storage account for mounting. Nice.

more to follow…

8 thoughts on “From the #datacenter: Converting #VMware to Hyper-V got even easier!

  1. konrad scieer

    I installed Microsoft Virtual Machine Converter v3 and this hack don’t work 🙂
    i change script: $modulepath -match “v1.0” -> $modulepath -match “v3.0”

    1st step goes fine but Import-Module mvmccmdlet shows:
    Import-Module : The specified module ‘mvmccmdlet’ was not loaded because no valid module file was found in any module directory.
    At line:1 char:1
    + Import-Module mvmccmdlet
    + ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ResourceUnavailable: (mvmccmdlet:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

    is there upgraded version of the script for v3 MVC ?

    Reply
    1. sebmatthews Post author

      Hi Konrad
      With v3 the hack should no longer be required, the installer will place the module in a unique path so the Import-Module cmd would look like:
      Import-Module “C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1”
      That should set you fair.
      SM

      Reply
  2. Antonio

    Hi!
    I tried using the cmdlet but when I am trying to run the script I receive this error:
    ConvertTo-MvmcVhd : The entry “” is not a supported disk database entry for the descriptor.
    At line:3 char:1
    + ConvertTo-MvmcVhd -SourceLiteralPath $path -DestinationLiteralPath “C:\VMs\SP201 …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVirtualHardDisk], VmdkDescriptorParseException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskCommand

    ConvertTo-MvmcVhd : One or more errors occurred.
    At line:3 char:1
    + ConvertTo-MvmcVhd -SourceLiteralPath $path -DestinationLiteralPath “C:\VMs\SP201 …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVirtualHardDisk], AggregateException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskCommand

    I tried to have a look over internet about this error but I cannot find anything.
    Do you have some ideas about?
    Thanks!

    Reply
  3. Q

    yeah i get the same not a supported disk database entry for the descriptor error

    Reply
  4. Dave

    How does the cmdlet handle or how do you specify a source vmdk file if it is made up of several or many vmdk files? Do you just specifiy the base file name and the cmdlet rolls them all up into the destination vhdx?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *