Import Hyper-V Virtual Machine in Windows 10  

    Import Hyper-V Virtual Machine in Windows 10

    Import Hyper-V Virtual Machine in Windows 10

    How to Import Hyper-V Virtual Machines in Windows 10
    Published by Category: Virtualization
    19 Apr 2020
    Designer Media Ltd



    How to Import Hyper-V Virtual Machines


    Hyper-V enables running virtualized computer systems on top of a physical host. These virtualized systems (aka: guests) can be used and managed just as if they were physical computer systems, however they exist in a virtualized and isolated environment.

    You can use Hyper-V's export and import functionality to quickly duplicate virtual machines. Exported virtual machines can be used for backup or as a way to move a virtual machine between Hyper-V hosts.

    Import allows you to restore virtual machines. You don't need to export a virtual machine to be able to import it. Import will try to recreate the virtual machine from whatever is available. Importing a virtual machine registers the virtual machine with the Hyper-V host. A virtual machine export can be imported back into the host from which it was derived or new host.

    This tutorial will show you how to import a Hyper-V virtual machine (guest) on your Windows 10 PC (host).

    You must be signed in as an administrator to be able to import a Hyper-V virtual machine.

    Hyper-V is only available in the Windows 10 Pro, Windows 10 Enterprise, and Windows 10 Education editions.


     CONTENTS:

    • Option One: To Import Hyper-V Virtual Machine using Hyper-V Manager
    • Option Two: To Import Hyper-V Virtual Machine using PowerShell



    Video by: Kari in TF Video thread






    OPTION ONE

    To Import Hyper-V Virtual Machine using Hyper-V Manager


    1. Open Hyper-V Manager.

    2. Select the Hyper-V host (ex: "BRINK-DESKTOP") in the left pane you want to import a virtual machine to, and click/tap on Import Virtual Machine in the right Actions pane. (see screenshot below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-1.png

    3. Click/tap on Next on the "Before you Begin" screen. (see screenshot below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-2.png

    4. Click/tap on Browse, navigate to and select the folder (ex: "Windows 7 Ultimate") that contains the virtual machine (.vmcx file) you want to import, click/tap Select Folder, and click/tap on Next. (see screenshots below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-3.png

    5. Select the virtual machine (ex: "Windows 7 Ultimate") you want to import, and click/tap on Next. (see screenshots below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-4.png

    6. Select (dot) an import type you want to perform, click/tap on Next, and go to step 7 or step 8 below depending on what import type you selected. (see screenshot below)

    Import Type Description
    Register the virtual machine in-place The current location of the Export files is where the virtual machine will be run from. When imported, the virtual machine has the same ID as it did at the time of export. Because of this, If the virtual machine is already registered with Hyper-V it needs to be deleted before the import will work. When the import has completed, the export files become the running state files and cannot be removed.
    Restore the virtual machine You are given an option to store the VM files in a specific location or use the locations default to Hyper-V. This import type creates a copy of the exported file and moves them to the selected location. When imported, the virtual machine has the same ID as it did at the time of export. Because of this, if the virtual machine is already running in Hyper-V it needs to be deleted before the import can be completed. When the import has completed the exported files remain untouched and can be removed and / or imported again.
    Copy the virtual machine This import type is similar to the Restore type in that you select a location for the VM files. The difference is that when imported the virtual machine has a new unique ID. This allows for the Virtual Machine to be imported into the same host multiple time.

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-5.png


     7. If you selected to "Register the virtual machine in-place"

    A) Click/tap on Finish on the "Summary" screen, and go to step 9 below. (see screenshot below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-6.png


     8. If you selected to "Restore the virtual machine" or "Copy the virtual machine"

    A) If you like, you can specify new or use existing folders to store the virtual machine files. When finished, click/tap on Next. (see screenshot below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-7a.png

    B) Browse to and select the folder where you want to store the imported virtual hard disks (.vhdx file) for this virtual machine, and click/tap on Next. (see screenshot below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-7b.png

    C) Click/tap on Finish on the "Summary" screen, and go to step 9 below. (see screenshot below)

    This may take a while to finish copying the virtual machine files and hard disk to the selected folder location(s).

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-7c.png

    9. The Hyper-V virtual machine (ex: "Windows 7 Ultimate") has now been imported to the selected Hyper-V host (ex: "BRINK-DESKTOP"). (see screenshot below)

    Import Hyper-V Virtual Machine in Windows 10-import_hyper-v_vm-8.png

    10. When finished, you can close Hyper-V Manager if you like.






    OPTION TWO

    To Import Hyper-V Virtual Machine using PowerShell


    For more details about the Import-VM command used in this option, see: Import-VM

    1. Open an elevated PowerShell.

    2. Do step 3 (in-place), step 4 (in-place) (restore) or step 5 (copy) below for the import type you want to perform.


     3. To "Register the virtual machine in-place (use the existing unique ID)"

    The current location of the Export files is where the virtual machine will be run from. When imported, the virtual machine has the same ID as it did at the time of export. Because of this, If the virtual machine is already registered with Hyper-V it needs to be deleted before the import will work. When the import has completed, the export files become the running state files and cannot be removed.

    A) Type the command below into the elevated PowerShell, press Enter, and go to step 6 below. (see screenshot below)

    Import-VM -Path 'Full path of virtual machine .vmcx file'

    Note   Note
    Substitute Full path of virtual machine .vmcx file in the command above with the actual full path of where the virtual machine .vmcx file you want to import is located.

    For example:
    Code:
    Import-VM -Path 'D:\Vitual Machines\Windows 7 Ultimate\Virtual Machines\7BEDECF9-E91F-4115-9E86-BBFEE136D881.vmcx'
    Import Hyper-V Virtual Machine in Windows 10-vmcx.png

    Import Hyper-V Virtual Machine in Windows 10-powershell_register_in-place_hyper-v.png


     4. To "Restore the virtual machine (use the existing unique ID)"

    You have the option to store the VM files in a specific location or use the locations default to Hyper-V. This import type creates a copy of the exported file and moves them to the selected location. When imported, the virtual machine has the same ID as it did at the time of export. Because of this, if the virtual machine is already running in Hyper-V it needs to be deleted before the import can be completed. When the import has completed the exported files remain untouched and can be removed and / or imported again.

    A) Type the command below you want to use into the elevated PowerShell, press Enter, and go to step 6 below. (see screenshot below)

    (To use default Hyper-V folders to import and copy virtual machine .vmcx and virtual hard disk .vhdx files)
    Import-VM -Path 'Full path of .vmcx file' -Copy

    OR

    (To specify Hyper-V folders to import and copy virtual machine .vmcx and virtual hard disk .vhdx files)
    Code:
    Import-VM -Path 'Full path of .vmcx file' -Copy -VhdDestinationPath 'Full path of folder to copy .vhdx file' -VirtualMachinePath 'Full path of folder to copy .vmcx file'
    Note   Note
    Substitute Full path of .vmcx file in the commands above with the actual full path of where the virtual machine .vmcx file you want to import is located.

    Substitute Full path of folder to copy .vhdx file in the second command above with the actual folder path where you want to copy the virtual hard disk .vhdx file of the virtual machine you want to import.

    Substitute Full path of folder to copy .vhdx file in the second command above with the actual folder path where you want to copy the virtual machine .vmcx file of the virtual machine you want to import.

    For example:
    Code:
    Import-VM -Path 'D:\Vitual Machines\Windows 7 Ultimate\Virtual Machines\7BEDECF9-E91F-4115-9E86-BBFEE136D881.vmcx' -Copy -VhdDestinationPath 'D:\Vitual Machines\Windows 7 Ultimate - Copy' -VirtualMachinePath 'D:\Vitual Machines\Windows 7 Ultimate - Copy'

    Import Hyper-V Virtual Machine in Windows 10-powershell_restore_hyper-v.png


     5. To "Copy the virtual machine (create a new unique ID)"

    This import type is similar to the Restore type in that you select a location for the VM files. The difference is that when imported the virtual machine has a new unique ID. This allows for the Virtual Machine to be imported into the same host multiple time.

    A) Type the command below you want to use into the elevated PowerShell, press Enter, and go to step 6 below. (see screenshot below)

    (To use default Hyper-V folders to import and copy virtual machine .vmcx and virtual hard disk .vhdx files)
    Import-VM -Path 'Full path of .vmcx file' -Copy -GenerateNewId

    OR

    (To specify Hyper-V folders to import and copy virtual machine .vmcx and virtual hard disk .vhdx files)
    Code:
    Import-VM -Path 'Full path of .vmcx file' -Copy -VhdDestinationPath 'Full path of folder to copy .vhdx file' -VirtualMachinePath 'Full path of folder to copy .vmcx file' -GenerateNewId
    Note   Note
    Substitute Full path of .vmcx file in the commands above with the actual full path of where the virtual machine .vmcx file you want to import is located.

    Substitute Full path of folder to copy .vhdx file in the second command above with the actual folder path where you want to copy the virtual hard disk .vhdx file of the virtual machine you want to import.

    Substitute Full path of folder to copy .vhdx file in the second command above with the actual folder path where you want to copy the virtual machine .vmcx file of the virtual machine you want to import.

    For example:
    Code:
    Import-VM -Path 'D:\Vitual Machines\Windows 7 Ultimate\Virtual Machines\7BEDECF9-E91F-4115-9E86-BBFEE136D881.vmcx' -Copy -VhdDestinationPath 'D:\Vitual Machines\Windows 7 Ultimate - Copy' -VirtualMachinePath 'D:\Vitual Machines\Windows 7 Ultimate - Copy' -GenerateNewId

    Import Hyper-V Virtual Machine in Windows 10-powershell_copy_hyper-v.png


    6. When finished, you can close PowerShell.

    This may take a while to finish copying the virtual machine files and hard disk to the selected folder location(s).


    That's it,
    Shawn






  1. Posts : 26,819
    Win11 Pro, Win10 Pro N, Win10 Home, Windows 8.1 Pro, Ubuntu
       #1

    @Brink,
    I just had to use this today:)
    Thanks to you and @Kari, I started exporting my VMs a short while ago(specially now that my Insider and Windows 8.1 VMs are licensed) and never needed to import.

    Today I did something really, really dumb!

    I was deleting my checkpoint sub trees totally on all three of my VMs(to recover what space, and all machines are/were working perfectly(yes, even the insider build)), and on my 3rd(insider build) I accidentally deleted it!
    Import Hyper-V Virtual Machine in Windows 10-swearing.gifImport Hyper-V Virtual Machine in Windows 10-swearing.gifImport Hyper-V Virtual Machine in Windows 10-swearing.gif

    Well, I'm now reimporting it...
    Import Hyper-V Virtual Machine in Windows 10-image.png

    So I posted this to thank you & Kari, and also to show Hyper-V Geeks why it is very important to export!
      My Computers


  2. Posts : 26,819
    Win11 Pro, Win10 Pro N, Win10 Home, Windows 8.1 Pro, Ubuntu
       #2

    Finished!
    Now to upgrade:)
    Again...!
    Import Hyper-V Virtual Machine in Windows 10-image-001.png
      My Computers


  3. Posts : 64,536
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #3

      My Computers


  4. Posts : 10
    Win7; Win10; CentOS; Suse;
       #4

    Folder Structure, Organizing


    @Brink
    Lots of valuable info, kudos both you & Kari.
    This prolly aint the place, but in regards to 'keepin it clean' (file structure). I have all created/dynamic data on a different partition from OS (Win10P64); is there any recommended format w/regards to Hyper-V that could be advantageous? Have a top level for all VM's, /VMname with everything under (.vhdx, .vmcs, .vmcx) & don't know if this would be detrimental down the road...?
    A tad different than a full-blown hyperVisr (ESXi) & now it seems this build on 10 is pretty sweet, thus curious on structure cleanliness.
    ...behavior mods for me - 'Save' 'Shutdown' & 'Turn Off' had to play with as no one said anything (yes I read Ben Armstrong's Virt Blog on turning off a VM here, referenced several times over the years ).

    Wish there was a way to 'Save' while using an RDP session (not using VM connection).
    Sorry if this appears as cross-post . But I'll keep looking around, thx all fer sharing info...!
      My Computer


  5. Posts : 64,536
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #5

    Hello @sos1043, :)

    I prefer to keep my Hyper-V VMs on a separate hard drive that the OS drive as well. This way if I should have to reinstall Windows, all I have to do is import my VMs back afterwards.

    I prefer to keep individual VM in its own separate folder with all of its files.
      My Computers


  6. Posts : 10
    Win7; Win10; CentOS; Suse;
       #6

    My thoughts and usage exactly. Thought I'd check.
    Any quick notes on an RDP session opposed to the VM connection application, then 'Save'?
      My Computer


  7. Posts : 64,536
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #7

    Not sure about the RDP option, but that would make a good question to post in a new thread to get feedback about.
      My Computers


  8. Posts : 80
    Windows 10 Pro 64 bit
       #8

    Thank you Brink very useful tutorial.
      My Computer


  9. Posts : 64,536
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #9

    I'm glad it could help matfx. :)
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 15:36.
Find Us




Windows 10 Forums