Import a Hyper-V Virtual Machine with PowerShell

I recently ran into a problem where an exported VM from Windows Server 2016 running Hyper-V wasn’t able to be imported on Windows Server 2019 running Hyper-V. When attempting to perform the import, the GUI stated “No virtual machines files found” as shown in the following image. This problem may have been due to using Hyper-V manager on a remote system running Windows Server 2012 R2, although the same system was used for the export.

Since the Hyper-V servers themselves were installed with the Server Core installation option (no GUI), I decided to try importing the VM with PowerShell instead. I was able to successfully import it using the following command.

What I also learned is that if the Hyper-V configuration files exist on a volume on a storage device such as a SAN and that entire volume is connected to the new server, you can simply import the VM without needing to perform an export first. It appears that all an export does is copy the VHD/VHDX files, configuration files, snapshots, etc.

The previous command performs a “Register in-place” of the VM instead of performing a copy of the files. It assumes that you already have the correct file structure in place as would be the case for performing a simple migration of a storage volume and VM to a new Hyper-V server.

More information can be found in this Microsoft “Export and Import virtual machines” article and the PowerShell help topic for Import-VM.

Thoughts, questions, comments? Please post them as a comment to this blog article.


1 Comment

  1. Don Cuthbert

    I was having trouble recalling how to Import my VMs after a clean-install of Windows 10 and found your page. I have many Hyper-V VMs, so I used this command to Import them all from my data drive, using Register in-place:

    dir “D:\HYPER-V\Virtual Machines\*.vmcx” | Import-VM -Register


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: