How to Import and Export Hyper

choubertsprojects

VPN offers!

1. NordVPN

2. Surfshark

3. ExpressVPN

Hyper is a high-speed and low latency blockchain that allows for fast transacting. It uses the technology of Smart Contracts to make trading easier than ever before. Hyper has been designed to be used by anyone, in any country, on any continent without needing an exchange or middleman through its decentralized network.

Hyper-V is a virtualization technology that allows users to create and run multiple operating systems on one computer. The “hyper-v did not find virtual machines to import from location” is an issue that can occur when using Hyper-V, which will cause the process to stop.

How to Import and Export Hyper

Do you need to export and move a Hyper-V virtual machine from one host to another? Consider moving a virtual machine from your development workstation to a production Hyper-V host. If that’s the case, you’ve arrived to the correct spot!

In this article, you’ll learn how to use the Hyper-V Manager and PowerShell to export and import virtual machines. Ready? Let’s get started!

How To Manage Hyper-V Host From A Windows Client That Isn’t In A Domain

Prerequisites

This page will serve as a guide. You’ll need the following items if you want to follow along step-by-step:

  • Windows PowerShell 5.1 or PowerShell 7 — The instructions in this article will work with Windows PowerShell 5.1 as well as PowerShell 7.
  • A Hyper-V-capable Windows Server – This lesson is based on the March 2021 insider preview, however any Windows Server from 2012R2 forward will work.
  • A visitor in a virtual machine – Because Alpine Linux is resource-light, it is used in this lesson. You are free to employ any guest operating system.
  • On the Hyper-V host, a local Windows user account in the local administrators group.

Exporting a VM using Hyper-V Manager

If you don’t want to use the command line or just have one virtual machine to save to disk, the Hyper-V manager is a good option. Assuming you have a virtual machine operating on your Hyper-V host:

1. Type “hyper” into the Windows search box. You should see the Hyper-V Manager console appear. If so, open it by clicking on it.

2. Locate the VM you want to export, right-click it, and choose Export.

Using Hyper-V Manager to export a VM Before exporting, the VM might be offline or operating.Using Hyper-V Manager to export a VM Before exporting, the VM might be offline or operating.

3. Select a location to store the VM and settings, then click Export.

Virtual Machine Export Dialog Virtual Machine Export Dialog

The place where you store the exported VM should have adequate storage space. This will differ. Remember that just because you have 60 GB of space allocated doesn’t imply the VM disk has expanded to 60 GB.

The status of the export will be shown in the Hyper-V Manager window after Hyper-V has started the export process.

Hyper-V Manager's Export StatusHyper-V Manager’s Export Status

4. Verify that all essential files are present. Three sub-folders should appear. All of the data necessary for the exported VM to start are included in these sub-folders: snapshots, virtual hard drives, and virtual machines.

VM example exportedVM example exported

  • The VM’s snapshot information is stored in the Snapshots subdirectory. If there were no snapshots for the VM, the folder may be empty. VMCX, VMRS, and VMGS file extensions may be found in this subdirectory. The VMCX binary file includes information about your exported VM’s settings. The VM runtime state information is stored in the VMRS binary file. The VM will not boot without this file. The VMGS file is the last but not least. I’m not sure what this file’s purpose is. Leave a comment if you know.

If you’ve worked with Hyper-V before, you may have noticed that the file extensions are different. Hyper-V no longer utilizes XML files for configuration information and instead uses binary files starting with Windows Server 2016. Learn more about the new extensions by clicking here.

You’ll notice numerous VMCX, VMRS, and VMGS files for each checkpoint your VM has if it has more than one.

Example of a Snapshots folderExample of a Snapshots folder

  • The Virtual Hard Disks folder includes all of the virtual machine’s hard disk image files (*.vhdx). The AVHDX, or Automatic virtual hard disk file, is a virtual machine checkpoint differencing disk. You will notice many AVHDX files if your virtual machine has more than one checkpoint.

Example of Virtual Hard DisksExample of Virtual Hard Disks

  • The VM configuration files needed to boot the VM are located in the Virtual Machines subdirectory. You’ll find VMCX, VMRS, and VMGS binary files here, just like in the Snapshots folder.

Example of virtual machine setup files Example of virtual machine setup files

Your export was successful if all three directories are present and contain files.

Exporting a VM using PowerShell

If you’re a fan of the command-line or have a lot of VMs to export, Exporting a VM using PowerShell is a great option also. To export a Hyper-V with PowerShell, use the Export-VM cmdlet. To do so, assuming you’re on your Hyper-V host and your VM is offline:

Open a PowerShell console first.

2. Request an inventory of your VMs from the Hyper-V host, as well as the name of the VM to export. This guide will create a virtual machine named Alpine Linux 01.

The name of the virtual machine to use in the Export-VM commandThe name of the virtual machine to use in the Export-VM command

3. Make a folder in which to save the VM. The VM will be exported to C:Export VM in this tutorial.

‘Exported VM’ -Name ‘New-Item -ItemType Directory -Path ‘C:’

4. Now run the Export-VM cmdlet with the Name parameter set to the name of the virtual machine, the Path parameter set to the folder to save it to, and the PassThru parameter set to true.

The PassThru argument may be used to return the exported VM object. Otherwise, Export-VM produces nothing.

Export-VM -Path ‘C:Exported VM’ -Passthru ‘Alpine Linux 01’

An offline virtual machine was successfully exported. An offline virtual machine was successfully exported.

When a VM is operating, Export-VM does not save the memory automatically. Use the -CaptureLiveState CaptureSavedState argument with Export-VM to save the contents of memory executing in the VM. Learn more about the memory-capture technology.

Remove the VM from Hyper-V now. Don’t be concerned! You’ve managed to save it!

Remove-VM ‘Alpine Linux 01’ -Name

Importing a VM using Hyper-V Manager

Once you’ve exported the VM, the tragedy has hit, and the VM is no longer available. Don’t be concerned! You’ve already saved it to your hard drive. Let’s bring things back together. Assuming you’re back on your Hyper-V host, follow these steps:

Open Hyper-V Manager first.

2. On the right side of the Hyper-V Manager window, click the Import Virtual Machine menu option. The wizard for importing virtual machines appears. Select Next.

Wizard to Import Virtual MachinesWizard to Import Virtual Machines

3. Click Next after entering the path of the exported virtual machine you wish to import. The VM is saved to C:Export VMAlpine Linux 01 for this tutorial.

Unlike when using PowerShell, the wizard will automatically find the VM’s VMCX file.

Wizard to Import Virtual MachinesWizard to Import Virtual Machines

4. When Hyper-V detects the VM configuration files in the folder (in this case, C:Exported VMAlpine Linux 01Virtual Machines), it will prompt you to choose a virtual machine to import. Click Next after selecting the VM you wish to import.

Wizard to Import Virtual MachinesWizard to Import Virtual Machines

5. Select the kind of import you wish to do next. Let’s take a closer look at the possibilities first.

When you choose ‘Register the virtual machine in-place (use existing unique ID),’ you are presuming that the exported VM files are in their final location and that the VM is not being moved to a new folder. The virtual machine’s operating state is saved in the exported VM files. The UID remains constant.

Hyper-V utilizes the UID to identify a virtual machine. You will get an error if Hyper-V finds that the identical UID is presently registered.

When you restore the virtual machine, you may pick a place for the exported virtual machine files to be transferred to or use the default Hyper-V location.

It’s comparable to recovering an exported virtual machine when you duplicate it, but with a new unique ID (UID). A new UID allows you to reinstall the same virtual machine to the same or other Hyper-V hosts many times.

Select the Import Type Copy the virtual computer for demonstration purposes. A new unique ID will be generated when you copy the VM (UID). A UID is assigned to each Hyper-V VM. For the time being, this choice will suffice, so click Next.

Wizard to Import Virtual MachinesWizard to Import Virtual Machines

6. Because you selected Copy, you may now alter the location of the virtual machine files. Accept the settings for this lesson by clicking Next.

Wizard to Import Virtual MachinesWizard to Import Virtual Machines

7. Finally, create a Storage Folder for the virtual machine. The VHDX and AVHDX files will be stored in the Storage Folder. Accept the default location for this instruction and click Next.

Wizard to Import Virtual MachinesWizard to Import Virtual Machines

8. After reviewing the summary page, click Finish to begin the import.

Completing Wizard to Import Virtual Machines Completing Wizard to Import Virtual Machines

When Hyper-V has finished importing, it will return to the Hyper-V Manager window, where you will see the newly Imported virtual machine, as seen below.

Imported virtual machineImported virtual machine

Importing a VM using PowerShell

If using the Hyper-V Manager to import a VM isn’t your thing, no worries. Use PowerShell instead! The Import-VM cmdlet is used to import a VM using PowerShell. Consider the case below:

You’ve exported a virtual machine, and it’s sitting at C:Exported VM. What if it’s accidently removed, or you need it on a different Hyper-V host? Because it has previously been exported, it is effectively backed up and can be readily imported, restoring the VM.

The Import-VM cmdlet accomplishes the reverse of the Export-VM cmdlet, reading a VM from disk and importing it into Hyper-V.

1. Assume you already have a PowerShell console open and are at the C:Exported VM directory where you exported a VM. To begin, use the Get-ChildItem cmdlet with the Recurse option to display all of the files, then use the code below to note the filename with the *.vmcx extension:

Where-Object -Property Name -CLike *.vmcx | Get-ChildItem -Recurse

Depending on if the exported VM included snapshots, you may see multiple.vmcx files. The VMCX file in the Virtual Machines folder is the only one you’ll need to boot the VM.

You could get anything like the following:

Exported VM UID example - VM configuration file (vmcx)Example of an exported VM UID – VM configuration file (vmcx)

2. Next, provide the VMs configuration file using the Path option of the Import-VM cmdlet (obtained in the previous step).

‘.Alpine Linux 01Virtual Machines.vmcx’ Import-VM -Path

That’s everything! You’ve put the VM in place and given it the same UID it had when it was exported.

Installing a virtual machineInstalling a virtual machine

3. Check that the UID matches the name of the.vmcx file that was created when the VM was exported. By querying WMI, you may accomplish precisely that using the code below:

(CimInstance -Namespace RootVirtualizationV2 -ClassName Msvm VirtualSystemSettingData -Filter “ElementName = ‘Alpine Linux 01′”) InstanceID

You should get something similar to the following:

Retaining the UIDRetaining the UID

The VM kept the original UID after the previous example was imported directly from the VM configuration file. You may wish to produce a new UID in a production environment to avoid an old VM from being mistaken for a new VM. The Copy argument is used in this case.

When you use the Copy argument to import a virtual machine, the files from the original location (C:Exported VM) are copied into the Hyper-V server’s predefined paths. The VM may be imported numerous times on the same Hyper-V server with a new unique identification when GenerateNewId is used (UID).

‘.Alpine Linux 01Virtual Machines.vmcx’ Import-VM -Path -Copy -GenerateNewId

This time, the Imported virtual machine does not contain the same UID as when exported. You see the old, and new UIDs in the screenshot below:

Showing the difference between the old UID before the import and the new UID produced using the Copy and GenerateNewID parameters.Showing the difference between the old UID before the import and the new UID produced using the Copy and GenerateNewID parameters.

When you import a VM using Hyper-V Manager, Hyper-V transfers the VM to the usual directories, but it gets a new UID.

Steps to Follow

You’ve learned how to use PowerShell and the built-in Hyper-V management to export and import a Hyper-V VM in this article.

Try setting up Automatic Virtual Machine Activation (AVMA) to activate Windows Server virtual machines hosted on Hyper-V now that you know how to export and import Hyper-V virtual machines.

The “hyper-v move vm to another host without export” is a tutorial that will show you how to import and export Hyper V virtual machines.

Related Tags

  • export virtual machine hyper-v
  • export vm hyper-v powershell
  • export hyper-v configuration
  • hyper-v export vs backup
  • export hyper-v vm to vmware