Virtual Machines (VMs) can be added to the vSphere Inventory in vCenter Server or in an ESXi from GUI or command line of the ESXi host.
To register a virtual machine in vCenter Server:
- Log in to vSphere Client.
- Click on the desired host.
- Click the Datastores tab
- Click on the appropriate datastore
- Click on the Files tab
- Locate the correct directory for the VM and double-click it to open the folder
- Locate the
virtual machine.vmx
file and click on it to highlight it.
- Click the "Register VM" button
- Continue to follow the wizard to add the virtual machine.
To register a virtual machine from the command line in an ESXi host:
- Log in as root to the ESXi host with an SSH client. For more information about enabling SSH on an ESXi host, see Using ESXi Shell in ESXi
- Run the command:
# vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx
To unregister a virtual machine in vCenter Server:
- Log in to vSphere Client.
- Power off the virtual machine.
- Right click on the virtual machine and select "Remove from inventory".
To unregister a virtual machine from the command line in an ESXi host:
- Log in as root to the ESXi host with an SSH client. For more information about enabling SSH on an ESXi host, see Using ESXi Shell in ESXi
- Obtain the VM's VM ID by running vim-cmd vmsvc/getallvms and looking at the leftmost column.
- Run the command:
# vim-cmd
vmsvc/getallvms | grep <vm_name>
# vim-cmd
vmsvc/unregister <VM ID>