Applies for Server 2008, 2008R2, 2012 !
Let’s say you need to remove a VM from the Hyper-v inventory without deleting the VM itself and then re-register it.
You can follow these steps to delete the specific file symbolic link:
1.Navigate to the folder of the VM you want to unregistered. You will find a XML file like “E8C72757-998B-4554-8570-9072601C74FA.XML” in the subfolder Virtual Machines.Note:”
E8CB2757-498B-4554-8570-9082601C74FA” is the GUID of this VM.
2.Navigate to “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\” (it’s a hidden path), delete the “E8CB2757-498B-4554-8570-9082601C74FA.XML”. The specific VM will disappeared in Hyper-V Manager console.
Note: The above steps only delete the file symbolic link, the VM and its configuration will be kept in your HDD.
Bringing this VM back, you can perform the following steps:
1.Open an elevated command prompt, navigate to “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\”
2.Run the following command:
Mklink GUID.xml “D:\VM\Test-VM\Virtual Machines\GUID.xml”
Note: The GUID is the GUID of the specific virtual machine. You can get this number from the location where you put the configuration file (the .xml file). I am assuming that you put this configuration file at “D:\VM\Test-VM\Virtual Machines\GUID.xml”.