How to Convert a VMWare VMDK to Hyper-V VHD


A customer, who is a VMWare shop, gave me a VMDK file of one of their VMs for development purposes. I don’t have VMWare, but I do have Hyper-V on my dev boxes, so I needed to convert the VMDK virtual disk to a format I could connect to a Hyper-V VM.

Microsoft offers a VMWare VM conversion kit: http://www.microsoft.com/en-us/download/details.aspx?id=42497

The link above has a System Requirements section, please ensure your environment meets them before using the kit.

The kit has several pieces to help you convert a VMWare disk to a Hyper-V (or an Azure IaaS) VM compatible VHD format. There is a nice GUI wizard that will connect to the VMWare host, connect to a Hyper-V host, and convert the machine right across live.

In my case though, I just had the VMDK given to me by the customer. For this type of task, the kit has a whole set of PowerShell commands in a module. To get access to the commands in a PowerShell session, you need to import the module that defines them. Assuming the default kit install directory, you can use this command to import the module from a PowerShell command prompt:

Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'

With the module imported, several PowerShell commands are made available to perform all kinds of conversion tasks. I used the below command to convert the VMWare VMDK files to VHD. Note that you’ll need to use your own directories and file names for the –SourceLiteralPath and –Destination arguments.

ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath d:\scratch\vmx\VM-disk1.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -destination c:\vm-disk1

Something to keep in your back pocket should you ever hit this situation.
I have also heard good reports about this tool from Starwind

Comments (25)

  1. Martin says:

    wow, thank's for that! That's i was looking for... very cool

  2. Eloy says:

    Thanks for this. It is exactly what I needed.

  3. Ryan says:

    I had an old vmdk from VMware Server 2.0 that needed to be rescued, no budget to upgrade VMware, but available Hyper-V slots on a Windows 2008 R2 server. This Powershell call appears to be handling the conversion. Thanks!

  4. William says:

    Thanks for this.  Had all but given up on getting an Esxi working with my old hardware, but HyperV likes my network cards just fine.  Now I can run the VM on it too.

  5. Edwin Zeng says:

    Dear Experts,

    I tried to convert a over 450G vmdk (the 2nd hard driver on VM) with "ConvertTo-MvmcVirtualHardDisk" command line. But the converted vhd can't be attached to Hyper-V VM. It presents offline, and reminds me to convert to basic disk when I took it online.

    The small size one works well.

    I believe there are something wrong during the vmdk to vhd. Appreciate for any helpful ideas and best practices on converting a large size vmdk.

    Cheers,

    Edwin    

  6. Kenneth says:

    Super cool and very easy guide to follow for success.

    Just what i needed and I found that the -vhdtype actually could be vhd and not only vhdx which is not supported if using Azure.

    Thx.

  7. Thank you ! says:

    Lots of time saved.

  8. Michael says:

    Thanks for the post. I'll try again the next time, but was unable to convert my .vmdk file today. Here's the error message I received:

    ConvertTo-MvmcVhd : The entry 78f64467-4f3f-4143-9217-27a3c60314d4 is not a supported disk database entry for the descriptor.

    At line:1 char:1

    + ConvertTo-MvmcVhd

    + ~~~~~~~~~~~~~~~~~

       + 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:1 char:1

    + ConvertTo-MvmcVhd

    + ~~~~~~~~~~~~~~~~~

       + CategoryInfo          : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVirtualHardDisk], AggregateException

       + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskCommand

    1. Andy says:

      I was getting the "... is not a supported disk database entry for the descriptor" errors too. I found that this conversion tool would only successfully convert fixed VMDK disks but not dynamically expanding ones.

    2. Filip says:

      I had a similar issue but was able to solve it by modifying the descriptor. See http://stackoverflow.com/a/37482233/463041

  9. Robby says:

    Michael, I had the same issue, but then realized that there were two vmdk files, one tiny and one huge. Pointing to the tiny one worked. Counter-intuitive, but true...

  10. Robby says:

    Oh and Tim, thanks for the post, it saved me hours!

  11. Timi says:

    thanks a lot, this is exactly what i was looking for.

  12. Kevin says:

    Thank you sir!

  13. Evil_m says:

    it looks like its working but i get a new line that looks like below

    >>

    Is it doing something? i looked for the destination and there is nothing in it.

  14. Tom says:

    Module Import fail. What's wrong.

    Import-Module : Das Modul "C:program filesmicrosoft virtual machine convertermvmccmdlet.psd1" kann nicht importiert

    werden, da das zugehörige Manifest mindestens ein ungültiges Element enthält. Die gültigen Manifestelemente sind ('Modu

    leToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShel

    lVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitectur

    e', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', '

    ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Entfernen Sie

    die ungültigen Elemente ('RootModule'), und versuchen Sie dann erneut, das Modul zu importieren.

    Bei Zeile:1 Zeichen:14

    + import-Module <<<<  'C:program filesmicrosoft virtual machine convertermvmccmdlet.psd1'

       + CategoryInfo          : InvalidData: (C:program file...mvmccmdlet.psd1:String) [Import-Module], InvalidOperatio

      nException

       + FullyQualifiedErrorId : Modules_InvalidManifestMember,Microsoft.PowerShell.Commands.ImportModuleCommand

    1. JJ says:

      You are using powershell 2.0

  15. Mr.Wizard says:

    Or you could just use this FREE simple V2V tool from Starwind:

    http://www.starwindsoftware.com/converter

    Hasn't failed me yet.

    1. Eric says:

      I didn't see that the MS tool cost anything other than FREE

  16. RnGuy says:

    Hey,

    I tried a lot with this tool and failed every time so far, wrong namespace, wrong destination (how can I upload the image on HyperV Server without network shares..wtf).

    So gave starwind a try works like a charm <3

  17. Jordan says:

    Thanks. This was exactly what I was looking for. And straight to the point.

  18. Sean says:

    Thanks Tim! This has saved me hours of time!

  19. Russell Lilley says:

    just starting to use the instruction attached and found after some digging that you need powershell v3 or yourll get a error about root module when trying to import.

  20. bob says:

    You are the real mvp.

  21. TonyRin says:

    Thank you. Worked for me 🙂

Skip to main content