Skip to content

Instantly share code, notes, and snippets.

@rahilwazir
Last active March 3, 2024 22:01
Show Gist options
  • Star 82 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save rahilwazir/69a750b70348459875cbf40935af02cb to your computer and use it in GitHub Desktop.
Save rahilwazir/69a750b70348459875cbf40935af02cb to your computer and use it in GitHub Desktop.
Convert VMWare to Hyper-V (vmdk to vhdx)

VMDK to VHDX

Follow steps:

If you counter following error:

ConvertTo-MvmcVirtualHardDisk : The entry 1 is not a supported disk database entry for the descriptor.

In my case it was entry 4

Follow these steps:

  1. download and extract dsfok tools
  2. use dsfo.exe "c:\temp\disk2.vmdk" 512 1024 descriptor1.txt to extract the descriptor
  3. edit the descriptor file in Notepad++: comment the above mentioned line (as I added the extra single character (#) I also deleted one NULL character from the end to keep the file size of 1024 bytes (not sure if this is needed).
  4. use dsfi.exe "c:\temp\disk2.vmdk" 512 1024 descriptor1.txt to inject the descriptor back into the VMDK
  5. repeat these steps for the other disk (my VM has two .vmdk files)
  6. reissue the ConvertTo-MvmcVirtualHardDisk command
@IchBinGROOT
Copy link

This all looks very promising, did anyone ever write a script that automates this process? I‘d like to install Whonix in Hyper-V but didn’t get it to work so far

@SkybuckFlying
Copy link

Does not work:

3.1 Command 1:

Import-Module 'G:\Tools\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'

3.2 Command 2:

ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "D:\Virtual Machines\Windows 11 (VM 4, Official, RAD Studio 11 Alexandria, Windows 11 Updated, Reactivated)\Windows 11 x64.vmdk" -VhdType DynamicHardDisk -VhdFormat vhdx -destination "G:\Virtual Machines\Windows 11 (VM 4, Official, RAD Studio 11 Alexandria, Windows 11 Updated, Reactivated, Converted to VHDX)\Windows 11 x64.vhdx"

Error:

ConvertTo-MvmcVirtualHardDisk : No suitable drive was found at path (D:\Virtual Machines\Windows 11 (VM 4, Official,
RAD Studio 11 Alexandria, Windows 11 Updated, Reactivated)\Windows 11 x64.vmdk).
Parameter name: path
At line:1 char:1

  • ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "D:\Virtual Machine ...
  •   + CategoryInfo          : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVi
     rtualHardDisk], DriveNotFoundInPathArgumentException
      + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
     ommand
    
    

ConvertTo-MvmcVirtualHardDisk : One or more errors occurred.
At line:1 char:1

  • ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "D:\Virtual Machine ...
  •   + CategoryInfo          : WriteError: (Microsoft.Accel...nversionService:DriveConversionService) [ConvertTo-MvmcVi
     rtualHardDisk], AggregateException
      + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
     ommand
    
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment