Go to ...

RSS Feed

July 16, 2020

Exporting and importing Hyper-V virtual machines


Exporting and importing Hyper-V virtual machines is extremely easy. However, today I lost an important, activated Windows 10 VM when importing it back to my laptop, only because of a newbie mistake I made. Because of that, I thought it might be a good idea to share some tips about Hyper-V export and import, so that you can avoid what happened to me.

Export a VM

To export a Hyper-V VM, simply select VM in Hyper-V Manager, right click it and select Export, or select Export in Actions pane:

Click screenshots to open them enlarged in a new tab.

You can export a VM to any internal, external or network drive, as well as to any SD card, USB flash drive or to NAS. All VM virtual hard disks, checkpoints and settings will be exported. I use the export feature frequently, especially if the VM has been activated and has a Windows 10 digital license. When I want to start from scratch for instance after a fresh, clean install of Windows on my host, I can just import the VM back to that host, preserving its activation status and license. It is also practical if your dedicated Hyper-V VM disk or partition is relatively small; you can export all virtual machines, delete them from the host, and only import back those you currently need.

Exported virtual machines can be imported to any other Hyper-V host. Exporting a VM to an SD card, external USB HDD or flash drive allows you to move a VM from one host computer to another.

Import a VM

When importing a VM, you must select how to import it:

The red highlight in the preceding screenshot shows the default selection, something that today caused me to lose a valid Windows license, and which in my opinion should never be used and not be the default. “Register the virtual machine in-place” means that the selected VM will be added to the host’s Hyper-V Manager and can be run from there, but nothing is moved. The VM files will remain where the VM is exported.

The problem is, that when you then delete this VM in Hyper-V Manager, it and all its files on export target will be deleted. If the VM was activated, as in my case today, it’s gone and can’t be restored / saved. I emphasize: you’ve lost that Windows license.

Accidentally, I selected that option today. It was my own mistake, clicking too fast. My intention was to to select the second option, “Restore the virtual machine” (yellow highlight). This option keeps the exported VM on export target device / partition, copying all VM files to the host computer. When the VM is run, it is run from the host, not from the export target. Deleting VM later on the host does not delete the exported copy.

Both preceding options preserve the unique machine GUID, meaning that for instance activation status, license and all user and other SIDs will be the same as in the original VM which was exported. Selecting the third option, “Copy the virtual machine” (yellow highlight), will create a new VM configuration file (new GUID, SIDs). All VM files except the VM configuration file (.vmcx) will be copied to the host, and a new VM will be created using the imported virtual hard disks, checkpoints and settings. But this VM is like a fresh, new Windows 10 install. Windows on it will not be activated, and it will not have a digital license even if the original, exported VM was activated.

Personally, I see no reason to use either the first (in-place register) or the third (copy) options. Today, I just wanted to copy some files from one of my exported, activated virtual machines to the host, and then delete the VM from Hyper-V Manager. Selecting the wrong import option, I only realized too late that I had completely lost that VM and a valid Windows 10 Pro license with it. Registering it in-place, when I a few minutes later deleted the VM from host, its files were deleted from my “safe” Hyper-V Export folder on NAS. I cannot undo that.

Recommendations

– Use a portable device or NAS as export target, This allows you to transfer VM to any device
– When importing, always select “Restore the virtual machine” option

Kari

Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

3 Responses “Exporting and importing Hyper-V virtual machines”

  1. Storageman (TenForums)
    March 27, 2020 at 22:40

    Kari
    I tried to export a couple of UNIX VM’s that I use almost not at all, but I don’t want to delete them. Every time I try to export the VM, it asks me to select the target folder (I select my NAS system and sub folder to send it to), and then it gives me an ERROR “the system cannot find the target folder” ? It actually creates another sub folder under the named folder and its named by the VM Machine name I gave it.

    However, It does work just fine sending it to a USB Memory stick.

    • March 28, 2020 at 15:06

      I have no issues with exporting virtual machines to NAS. The thing is, the export folder on NAS must be set to public access (no password). When Hyper-V export opens Explorer to let you choose export location, type \\NAS_Name\ExportFolder in addressbar, and hit Enter to open that location, and select that location.

  2. Storageman (TenForums)
    March 29, 2020 at 20:22

    Yes that worked. I was trying to address the nas via as a mounted disk. Hyper-V didn’t like that
    Thanks

Leave a Reply

More Stories From Hyper-V