How to in-place register a VM to the host's default location

There seems to be a glaring hole in Hyper-V's virtual machine export/import toolset. Perhaps I'm mistaken with this assessment, but I don't think so.

I have a VM that I restored from backup after a host OS reinstall. The VM's location (and its VHDXs) are outside of the host's defaults (C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines and D:\Virtual Hard Disks). I wish to move it to these locations, but as the VHDXs are rather large (+10TB) a standard import promises at least a twelve-hour copy job. The VHDXs are on the same drive, albeit in a different folder, as the default, so shutting down the VM and moving them will be trivial.

I tried copying the configuration files to the default location and running an in-place registration, but I encountered an error:

enter image description here

Needless to say, this is not very helpful.

I suppose I could manually create a new VM and point to the VHDXs, but I've painstakinly crafted its configuration over time and I'd rather not risk missing a setting by accident.

How can I get this VM into the default location without requiring the arduous task of copying those large VHDXs?


The main VM configuration file (.vmcx) contains pointers to all the other files, including the virtual hard disks; as such, registering a VM in-place requires all files to be in the same place where they were originally located. The only way to change paths is to import the VM, either by restoring or copying it.

If the virtual hard disks only needs to be moved between different paths in the same volume, you can use this workaround to avoid an unnecessary file copy:

  • Register the VM in place where it is.
  • Remove the virtual hard disks from the VM (this will only remove the configuration, the actual VHDX files will not be touched).
  • Move the VM to the desidered location using Hyper-V management tools; this should be quick, since there are no disks to be moved.
  • Manually move the virtual hard disks to the desidered location; this should be also quick, since they are on the same volume.
  • Re-attach the virtual hard disks to the VM.

Registering a VM in-place that's not in the hosts default location and wanting it to be in the hosts default location is a contradiction in terms. In-place registration means you want to register and run the VM in it's current location. I don't see this as a glaring hole. The possible outcomes are clear from Microsoft's documentation.

If you want to register it in the hosts default location then use one of the latter two options listed below.

Register in-place – This type assumes export files are in the location where you'll store and run the virtual machine. The imported 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 works. When the import has completed, the export files become the running state files and can't be removed.

Restore the virtual machine – Restore the virtual machine to a location you choose, or use the default to Hyper-V. This import type creates a copy of the exported files 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 intact and can be removed or imported again.

Copy the virtual machine – This is similar to the Restore type in that you select a location for the files. The difference is that the imported virtual machine has a new unique ID, which means you can import the virtual machine to the same host multiple times.

How can I get this VM into the default location without requiring the arduous task of copying those large VHDXs?

At the end of the day, regardless of how you accomplish it, if the VM's files aren't in the hosts default location then they need to be copied or moved to the hosts default location. The files need to physically be in the hosts default location to actually be in the hosts default location.