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.


Building on the instruction to use Import-VM, the following powershell script will import all VMs in the folder in-place, whether they are the older xml files or the newer vmcx files. Safe to run on a folder where some are already registered, as Import-VM will just show an error and move on.

Just set the BaseFolder appropriately and execute.

$baseFolder='Q:\Hyper-V\Virtual Machines\'
$vms=Get-ChildItem $baseFolder -Recurse | where {$_.extension -in ".xml",".vmcx"}
$vms |  ForEach {
    Write-Output "Importing $_"
    Import-VM -Path $_.FullName -Register
}

Read-Host -Prompt "Press Enter to continue"