Converting a VMDK to VHD with PowerShell is really easy. We all find our self in a situation that we have a “old” VMware VMDK disk that we need to convert to Hyper-V VHD disk without a VMware of Hyper-V host. Converting vm disk without a host can be done by using the PowerShell modules that come with Microsoft Virtual Machine Convert.
This post will guide you through the necessary steps to convert the disk with PowerShell.
Step 1 – Installing Microsoft Virtual Machine Converter
To convert the VMDK to VHD we need a conversion kit from Microsoft. With the Conversion Kit you can convert a Virtual Machines and Disk from VMWare to Hyper-V. The catch here is that the Conversion kit needs to connect to the VMware and Hyper-V host.
That is not always an option, but kit also comes with a PowerShell module that includes the capabilities for offline conversion. And that is exactly what we are going to use.
So download the and install the Conversion Kit.
Step 2 – Import the Powershell Module
After you installed the Microsoft Conversion Kit, start PowerShell and import the following module:
Import-Module "C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
Step 3 – Convert VMDK to VHD
When the module is imported we can convert the disks with the following cmdlet:
PS C:\> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath E:\SERVERNAME\SERVERNAME.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -destination E:\VHD\
When the conversion is done you can create a new Virtual Machine in the Hyper-V manager and select a existing disk. I have you multiple disk you will have to create the VM with one disk first and then go to settings and add the other disks.
More info about the Powershell Cmdlet and the Conversion kit: https://technet.microsoft.com/en-us/library/dn874008(v=ws.11).aspx
4 thoughts on “Convert a VMDK to VHD disk”
What version of powershell were you using when you did this? I’m getting an error.
It really helped me, thanks !!!!!
Thanks a million that was really helpful