Now that I have Windows Server 2016 with the Hyper-V role installed, I wanted to take advantage of this perfect environment to have running several virtual machines on it.
I created several VM and they were running really nice and easy.
Then I needed to convert a VMWare virtual machine that I was using with VMware installed on other PC. The virtual machine has Windows 7 installed, along with MS Office, Visual Studio and other useful applications and programs.
After investigating what tool could I use to accomplish this task, I discovered this Microsoft tool: Microsoft Virtual Machine Converter 3.0 that you can also download.
But, the problem was that the GUI of this tool only accepts VMWare machines that are hosted in ESX , ESXI or vCenter Server. I don’t have any of these. I just have VMWare Player.
The good news is that the newly installed Microsoft Virtual Machine Converter is just a GUI for the cmdlets that do the real work.
So I was able to import the Virtual Hard Disk (VMDK) with just ONE command in PowerShell, then creating a VM in Hyper-V and attaching the converted disk to it.
So, what are the steps to import a VMWare virtual machine into Hyper-V? (We need to import the Virtual Hard Disk, no need to import the virtual machine).
2) Once downloaded, install it.
3) After the installation finishes, open PowerShell as an administrator (right-click, Run as administrator).
4) run the following command: Import-Module “C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1”
5) Look for the folder where you have your VMWare Virtual machine disk (where the vmdk files are) and take note of the first vmdk file.
6) Take note of destination folder where you want the converted virtual hard disk to be.
7) Run this command (replacing the SourceLiteralPath and DestinationLiteralPath with your own paths.
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “F:\Main\Backups\HRF4\HRF4.vmdk” -DestinationLiteralPath “E:\imported hard disks\HRF4” -VhdType DynamicHardDisk -VhdFormat vhd
These are the parameters used:
SourceLiteralPath = It is the path to the vmdk file.
DestinationLiteralPath = It is the path to the new virtual hard disk.
VhdType = FixedHardDisk or DynamicHardDisk.
VhdFormat = VHD or VHDX.
8) Once the conversion is done, Create a new virtual machine (I just crated a Generation 1 machine) and then in the Connect Virtual Hard Disk settings, select “Use an existing virtual hard disk” and browse for the newly converted disk.
9) Start the machine. Maybe you’ll need to restart it one or more times to finish installing the drivers for the new machine.