Few days ago, one of my virtual center machine was crashed and my Microsoft SQL database was corrupted without backup(damm!).

Basically setting up a brand new Windows 2003 machine is pretty simple but setup a new Virtual Machine took me 2 days. The most important is my VM template is go missing. The quick solution is search for VM template and register (add to inventory) again.

SSH into my ESX server using putty and search for VM template file with extension “.vmtx”.

[root@malaysiavmesx01 vmfs]# find /vmfs -name *.vmtx

How to register a VM template using CLI:
[root@malaysiavmesx01 vmfs]# /usr/bin/vmware-cmd -s register

In my case, I will register my VM template as example below:
[root@malaysiavmesx01 vmfs]# /usr/bin/vmware-cmd -s register /vmfs/volumes/465eeddb-89b75750-a52d-011aa0289d15/W2K3STD/W2K3STD.vmtx
[root@malaysiavmesx01 vmfs]# /usr/bin/vmware-cmd -s register /vmfs/volumes/465eeda7-2a63d436-724b-011aa0289d15/RHEL5/RHEL5.vmtx

Probably you can check previous article “How to re-register a VM once it had been removed from ESX” posted by Craig for register a VM template using Virtual Center and browse through the data store.

The lesson tell me I MUST backup SQL database and VM template keep in the database.