Get back hyper-v VMs after in place reinstall of host OS

hyper-vhyper-v-server-2012-r2hyper-v-server-2016windows-server-2012-r2windows-server-2016

I have standalone win 2012 r2 server with hyper-v on it. It is my test server I use for experiments so it can be turned off anytime. That's not a problem.

Is it possible to import 2012r2 VMs to 2016 hyper-v without exporting them? Something like loading vbox files to virtualbox without the need of exporting machines in the first place? I'm running low on disk space and I would like to do clean install of host os and then somehow get back my current virtual machines to new hyper-v but without exporting and importing them. So they would still be in the same place they are now but just register them in hyper-v without much of IO operation to export and import them back.

I don't want to do in place upgrade of host os but clean install of 2016 and then load my vms.

Is it possible? If yes then how?

Best Answer

If you have the files, both the vhd(x) and the machine vmx file, and your system is configured the same with similar vSwitch names then you should be able to use the command Import-VM -Register path\to\the\file.vmx.

If you no longer have your VMX files then you should just re-create a new virtual machine and when asked about adding storage, use the existing vhd(x) files that you already have.