WavebreakmediaMicro - Fotolia
The GUI wizard offered by Microsoft Virtual Machine Converter can easily perform conversions, but the tool also...
provides the necessary PowerShell cmdlets to perform VMDK to VHDX conversions from the command line.
There are several reasons you might want to convert a VMware VM to a Hyper-V VM. One of the most common reasons is if you're in the process of migrating your whole environment from VMware vSphere to Microsoft Hyper-V. Or you might have opted to use Azure cloud services and now you want to move VMware workloads to the Azure IaaS cloud.
VMware VMs aren't supported by Azure, so you must convert VMDK to VHDX files. Follow the steps below to convert them.
Step 1: Download Microsoft Virtual Machine Converter (MVMC) 3.0, then install it.
Step 2: Open a PowerShell window and change the directory to C:\Program Files\Microsoft Virtual Machine Converter. Next, import the PowerShell module that ships with MVMC by executing the command below:
Once you import the module, you have several PowerShell cmdlets that can perform all kinds of conversions, including changing the generation of the converted VMDK files.
Step 3: Now that you have imported the MVMC PowerShell module, execute the ConvertTo-MvmcVirtualHardDisk PowerShell cmdlet.
Let's assume you have a VMDK file that needs to be converted to be usable with Hyper-V, and the VMDK resides in C:\Temp\VMX folder. To convert the VMDK to VHDX, use the PowerShell command below:
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath C:\Temp\VMX\OSDisk.VMDK -VHDType DynamicHardDisk -VHDFormat VHDX -Destination C:\Temp\VHDX\OSDisk
As you can see, you're telling the command that the VMDK file needs to be converted to VHDX by adding the -VHDFormat parameter. The resulting file is saved under C:\Temp\VHDX as OSDisk.VHDX. There is no need to add the .VHDX extension after the new file name.
VM conversion might fail due to several issues. MVMC generates a log file by the name of MVMC.LOG that is available under the C:\Temp folder. If the conversion fails, open the log file and look for error or warning strings.
Dig Deeper on IT systems management and monitoring
Related Q&A from Nirmal Sharma
Use System Center Virtual Machine Manager and PowerShell to make logical network management easy. Execute a script to display network virtualization ... Continue Reading
Hyper-V replication is easy to use, but there are a number of steps you should take during Hyper-V replication setup to ensure you stay abreast of ... Continue Reading
Manage Hyper-V clusters more easily with PowerShell cmdlets and scripts that automate the retrieval and display of node information, including node ... Continue Reading