Can VM-ID be reused if the original VM is deleted?
search cancel

Can VM-ID be reused if the original VM is deleted?

book

Article ID: 416732

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • Inventory reports or monitoring tools show a new MOID for recreated VMs, even when using the same VM name.
  • You can use below commandlet to find the vm-id [moid]
        PS (get-vm -name test).ExtensionData.moref.value
            'test-'is the vm name used
             
             Example below: 
             

Environment

VMware vCenter Server

Resolution

The VM ID (also known as the Managed Object ID, or MOID) is unique to each vCenter Server instance.
Once a VM is created, it is assigned a unique MOID that remains exclusive within that vCenter Server. Even if the VM is deleted, the same MOID will not be reused for any newly created VMs in that vCenter.

Example :
If we have a VM-test in vCenter with vm-id 1234 and later delete that vm from VC inventory.
There is no chance that new created vm's in same VC will pick vm-id 1234.
Even unregister, reregister same VM will result in new VM id.

Additional Information

REFERhttps://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere-sdks-tools/7-0/virtual-disk-development-kit-programming-guide/backing-up-virtual-disks-in-vsphere/design-and-implementation-overview/information-containers-as-managed-objects/unique-id-for-a-different-vcenter.html 

For direct connections to ESXi, the host address and moRef uniquely identify a virtual machine. However this moRef could be different from the one that vCenter Server returns, hence the fallback to instanceUuid.

**********************************************************************
The moRef that the ESXi host uses internally might be different from the one that vCenter Server uses. This is because vCenter Server assigns its own moRef identifiers to objects when managing them centrally across multiple hosts. So, the moRef from the ESXi host may not match the moRef that vCenter returns if the VM is part of a vCenter-managed cluster.

Fallback to instanceUuid: To handle this discrepancy, if there is a mismatch between the ESXi-host-specific moRef and the vCenter Server moRef, VMware uses the instanceUuid as a fallback identifier. This instanceUuid is consistent for the same VM, regardless of whether you're connected directly to the ESXi host or through vCenter Server, ensuring that the VM can still be uniquely identified.
**********************************************************************