In case you lost a VM or VM template in vSphere when rebuilding the vCenter server from the scratch or when you removed them but they still exist on the disk and datastore, you can easily bring them back by register them in vSphere like shown below.




Restore/Register a VM Template

Navigate to the datastore where the VM or VM template is still stored on. For a VM template select the *.vmtx file and click on REGISTER VM.

.vmtx file is created when you convert a virtual machine to a template. The .vmtx file replaces the virtual machine configuration file (.vmx file)

Source: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-CEFF6D89-8C19-4143-8C26-4B6D6734D2CB.html


vSphere recognize this as VM template and its original name. Select a folder where to register it back to.


Select a compute resource.


Finally click on FINISH.


Our VM template is back and shown up in vSphere again.




Restore/Register a VM

Navigate to the datastore where the VM or VM template is still stored on. For a VM template select the *.vmx file and click on REGISTER VM.

The *.vmx file is a Virtual machine configuration file.

Source: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-CEFF6D89-8C19-4143-8C26-4B6D6734D2CB.html


Select a name for the VM and a folder where to place it.


Select a computer resource.


Finally click on FINISH.





Links

Register a VM or VM Template with vCenter Server
https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-0289C1E8-7392-4AA7-B6C4-7429B3F85D0F.html

Virtual Machine Files
https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-CEFF6D89-8C19-4143-8C26-4B6D6734D2CB.html