VDI to VHD – Convert VirtualBox Virtual Machines to Virtual PC

Do you want to open or run VirtualBox virtual machines in MS virtual PC? if yes, then it can be done after converting disk file VDI to VHD. MS Virtual PC doesn’t support VDI ( VirtualBox hard disk file), therefore it should be converted to VHD (MS Virtual Disk format).  Here, I’m showing how to convert a Windows XP VM on VirtualBox to VHD and run it in Virtual PC.

No any third party software required for this conversion, VirtualBox built in command tool is enough. It’s very simple too. Windows 7 is my host in this example.

Follow the steps to convert VDI to VHD.

1) Always better to uninstall VB guest additions tools from virtual machine. This may cause issue on VPC.

2) VirtualBox snapshots keep separate VDI files for each machine.  So if you convert the original base VDI file, you will not get the latest state of virtual machine. Also, you can’t convert snapshot VDI files separately.  Therefore it’s recommended to delete snapshots, which will allow to merge current machine’s state to single original disk file.

Read more about snapshots and how to delete them

3) After completing above two steps, run the following command

vboxmanage clonehd WinXP.vdi F:\winxp.vhd --format VHD

WinXP.vdi – Working VM hard disk

F:\winxp.vhd – Destination and file name of VHD

The above command returned following error.

VDI to VHD

This is because of it is attached to one machine and listed in virtual media manager. Release and remove the disk from virtual media manager (Note – Do not remove the VDI file from physical hard disk).

Run the command again, which returned following successful VDI to VHD conversion message.

convert VDI to VHD

4) Now create a new machine and select correct Operating System ( Windows XP in this example)  in Virtual PC. Choose existing disk option and browse the converted VHD file.

VDI to VHD

Power on machine. VPC will install some addition drivers for it’s platform. Restart the machine after completion, also install Virtual machine additions to get more display and performance improvement in MS virtual PC.

Here is the screenshot of running same virtual machine on both desktop virtualization software.

desktop virtualization software

It hardly took 5 minutes to convert this working machine (2GB VDI) to Virtual PC. Some blogs and forums mentioned about third party software to convert VDI to VHD, but it can be done easily by VirtualBox command as shown here.

Do you face any difficulties? Feel free to share. If this information helpful then don’t miss to leave a comment.

Comments

  1. G says

    HI ,
    This is a Good tool. This works fine. Only issue i have faced when running this without uninstalling Guest Additions. (Not always but some time ). So better to uninstall that as mentioned above.

    Good show Dinesh !!! :)

    • says

      @G,
      Thanks for your comment and keep reading my blog.
      Yes, I never took chance without removing guest additions. Its always better to remove guest additions from any software (VMware, VB, VPC) before conversion.

  2. Rohan Sharma says

    Hi Dinesh, i had a problem regarding this. When i put in the command, it says it says invalid parameters “F:\Windows Xp”…. what to do…..

  3. praveen says

    Is the below command applies to mac too? I have virtual box on Mac, planning to move t Virtual PC. since you all moved to virtual PC, is it better than virtual box?

    Thanks,

    • says

      This is just for the people who want to move the VirtualBox VM to Virtual PC, I don’t say virtual PC is better than VirtualBox. VirtualBox is much better than virtual pc.
      I think vboxmange command will be same in Mac host also, I’m not sure.
      Please check in helps and process.

      Good luck.

  4. alvin says

    Hey, great guide but how do you get the command prompt to recognize the command “vboxmanage”? Sorry, I’m a bit slow and I need help :(. Thanks you so much!!

  5. mark says

    Hi, thanks for the very nice guide, however I have this error message in cmd

    ‘vboxmanage.exe’ is not recognized as an internal or external command, operable program or batch file.

    thanks for the help

    • says

      mark,
      You need to add virtualbox working folder (C:\Program Files\Oracle\VirtualBox) to PATH under Environment Variables in Advanced Settings of Windows System.

      Or you run the command from where its located ( again its under VirtualBox program folder)

      • mark says

        Thanks a lot, i was able to convert ubuntu.vdi to ubuntu.vhd with the following command in C:\Program Files\Oracle\VirtualBox>

        vboxmanage clonehd “C:\Userx\username\.Virtualbox\filename.vdi” “C:\Userx\username\.Virtualbox\filename.vhd” –format VHD

        However, it was not good enough to run ubuntu 10 on WVPC as mouse, keyboard, and other integration cannot be connected ^_^

        Thanks a lot again for the knowledge you’ve shared to us ^_^ More Power!!! ^_^

  6. Philipp says

    I always get this error:

    VBoxManage.exe: error: Cannot register the hard disk ‘C:\Program Files\Oracle\Vi
    rtualBox\test.vdi’ {ba4b0377-907f-470f-80ae-13e5f27a8137} because a hard disk VBoxManage.exe: error: Cannot register the hard disk ‘C:\Program Files\Oracle\Vi
    rtualBox\test.vdi’ {ba4b0377-907f-470f-80ae-13e5f27a8137} because a hard disk ‘C
    :\FreeBSD 7.1\FreeBSD 7.1.vdi’ with UUID {ba4b0377-907f-470f-80ae-13e5f27a8137}
    already exists
    VBoxManage.exe: error: Details: code E_INVALIDARG (0×80070057), component Virtua
    lBox, interface IVirtualBox, callee IUnknown
    Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadW
    rite, pMedium.asOutParam())” at line 209 of file VBoxManageDisk.cpp’ with UUID {ba4b0377-907f-470f-80ae-13e5f27a8137}
    already exists
    VBoxManage.exe: error: Details: code E_INVALIDARG (0×80070057), component Virtua
    lBox, interface IVirtualBox, callee IUnknown
    Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadW
    rite, pMedium.asOutParam())” at line 209 of file VBoxManageDisk.cpp

    Even if I delete C:\FreeBSD 7.1\FreeBSD 7.1.vdi’ the error shows up…

  7. says

    i have made a Batch file and put this in it (for me the vdi file is into C:\temp\virtualbox):

    @echo off
    cd C:\program files\oracle\virtualbox
    vboxmanage clonehd C:\temp\virtualbox\serversd02.vdi C:\temp\virtualbox\servervd02.vhd –format VHD
    pause
    exit

  8. says

    is it possible to use this tool for converting FROM Microsoft VPC to VirtualBox? We have couple of pc’s who are failing to run XP Mode and we need to run some software that’s not compatible with Windows 7, so I’m hoping to use an image from a machine that does run an XPMode vm file (.vhd)

  9. alex says

    when it says format to vhd, will that literally format and erase the virtual hd or just convert it to vhd?