How to register or add a Virtual Machine (VM) to the vSphere Inventory in vCenter Server
search cancel

How to register or add a Virtual Machine (VM) to the vSphere Inventory in vCenter Server

book

Article ID: 335224

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

This article provides steps to register or add a VM to vCenter inventory or in an ESXi host.

Environment

VMware vSphere ESXi 7.x
VMware vCenter Server 7.x
VMware vSphere ESXi 8.x
VMware vCenter Server 8.x

Resolution

Virtual Machines (VMs) can be added to the vSphere Inventory in vCenter Server/ Virtual Center or in an ESX/ESXi from GUI or command line of the ESX/ ESXi host.
 
To register a virtual machine in vCenter Server:
  1. Log in to vSphere Web Client (Flex/Flash or HTML5).
  2. Click on the desired host.
  3. Click the Datastores tab
  4. Click on the appropriate datastore
  5. Click on the Files tab
  6. Locate the correct directory for the VM and double-click it to open the folder
  7. Locate the virtual machine.vmx file and click on it to highlight it.
  8. Click the "Register VM" button
    • If using the Flex/Flash client, right-click the VMX file and then select "Register VM"
  9. Continue to follow the wizard to add the virtual machine.
To register a virtual machine from the command line in an ESXi host:
  1. 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 5.x, 6.x and 7.x
  2. Run the command:

    # vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx
 To unregister a virtual machine in vCenter Server:
  1. Log in to vSphere Web Client (Flex/Flash or HTML5).
  2. Power off the virtual machine.
  3. Right click on the virtual machine and select "Remove from inventory".

To unregister a virtual machine from the command line in an ESXi host:

  1. 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 5.x, 6.x and 7.x
  2. Obtain the VM's VM ID by running vim-cmd vmsvc/getallvms  and looking at the leftmost column.
  3. Run the command:

# vim-cmd vmsvc/getallvms | grep <vm_name>

# vim-cmd vmsvc/unregister <VM ID>



Additional Information

To know more about invalid or Orphaned VMs:
Virtual machines appear as invalid or orphaned in vCenter Server


When registering a virtual machine, remember:

  • A virtual machine should be registered on one ESX host at a time.

  • If an ESX host is being managed by vCenter Server, perform any virtual machine registration through vCenter Server.
    Note: Bypassing vCenter Server to register a virtual machine may cause a mismatch between the host and the vCenter Server Inventory and may cause unexpected results.
     
  • If you have an issue adding the virtual machine to inventory, verify the virtual machine's file integrity. For more information, see Verifying ESX/ESXi virtual machine file integrity.