Skip to main content
Pure1 Support Portal

Convert VMware OVA to Hyper-V Virtual Hard Disk (VHD)


For customers or partners running Microsoft Hyper-V as a primary or secondary virtualization platform this article serves as an example on how to convert an OVA to a Microsoft Hyper-V Virtual Hard Disk (VHD), Generation 1 format. OVAs use the Open Virtualization Format (OVF) to package all of the contents of a VMware application (MF, OVF and VMDK files). 

To understand more about Hyper-V Gen1 vs Gen2 read the following article


Using the Microsoft Virtual Machine Converter PowerShell Module a script can be written to convert and import a VMware OVA into a Hyper-V instance as a VHD file. The below demonstration video illustrates how the end-to-end process works. 

Windows PowerShell Script

Script Requirements

  • Script must be run from a Windows Server host which has the Hyper-V Role installed.
  • Windows Management Framework (WMF) 5.0 or greater. Refer to the Microsoft Docs for all the latest information on Windows PowerShell.
  • Microsoft Virtual Machine Converter PowerShell Module -- This is used to convert the OVA to a VHD.
  • 7Zip PowerShell Module (7Zip4PowerShell) -- This is used to unzip the OVA.

The native Expand-Archive PowerShell cmdlet in WMF 5+ encounters errors when extracting the OVA. Example:

New-Object : Exception calling ".ctor" with "3" argument(s): "End of Central 
Directory record could not be found."
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Arch
ive\Microsoft.PowerShell.Archive.psm1:933 char:23
+ ... ipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -Ar ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvoca 
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power 

Script Source 

#  Name: New-ActiveClusterMediatorVM.ps1
#  Version: 0.5
#  Purpose: Convert VMware OVA to Hyper-V VHD.
#Requires -Version 5

# Set default variables.
$ACMDirectory = "D:\ACM"
$VMName = "AC-MediatorTest"
$HyperVHost = "localhost"
$OVAName = "<NAME>.ova"
$SourceOVAPath = "$ACMDirectory\$OVAName"
$DestinationVHDPath = "$ACMDirectory\$VMName.vhd"
$vSwitchName = "vSwitch"

# Import the Microsoft VM Converter Powershell Module.
# Install from
Import-Module "C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
Import-Module -Name 7Zip4Powershell

# Unzip the <Name>.ova file to specified directory. An OVA is just a ZIP (TAR) file containing contents. 
Copy-Item -Path $SourceOVAPath -Destination "$ACMDirectory\$"
Expand-7Zip -ArchiveFileName "$SourceOVAPath" -TargetPath "$ACMDirectory\$VMName"

# Find VMDK to convert to VHD.
$VMDKName = (Get-ChildItem -Path "$ACMDirectory\$VMName" -Filter *.vmdk).Name
$SourceVMDKPath = "$ACMDirectory\$VMName\$VMDKName"

# Convert the .VMDK from the OVA to a Virtual Hard Disk (VHD) - Generation 1.
# To understand Gen1 vs Gen2 read
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath $SourceVMDKPath -DestinationLiteralPath $DestinationVHDPath -VhdType FixedHardDisk -VhdFormat Vhd

# Create new virtual machine with specified parameters.
New-VM -Name $VMName -MemoryStartupBytes 8GB -VHDPath $DestinationVHDPath -Generation 1 -SwitchName $vSwitchName | Set-VM -ProcessorCount 2 -Passthru | Start-VM