In some cases, two virtual machines with the same name may appear in the vCenter inventory.
One of them may appear to be powered on in vCenter, but when you check the ESXi host directly, it is not.
When attempting to power off the duplicate VM from vCenter, you may receive the following error:The object 'vim.VirtualMachine:vm-123456' has already been deleted or has not been completely created.
vCenter Server 7.0
vCenter Server 8.0
To remove the duplicate VM from vCenter, follow these steps:
⚠️ Important: These steps involve direct database changes. Proceed only if you are confident, and always create a backup or snapshot before making modifications.
Take an offline snapshot of the vCenter Server.
If you are running in Linked Mode, all vCenters in the linked group must be backed up or have an offline snapshot taken.
Note down the exact name of the affected VM.
You should see two different IDs for the same VM name. For example:
Check which VM entry has a power_state of 1 (powered on):
Example output:
Change the power state from 1 (on) to 0 (off):
Expected output:
id | dns_name | power_state
--------+--------------+-------------
123456 | VM_NAME | 0
(1 row)
Go back to the vSphere Web Client.
The affected VM should now appear powered off or orphaned.
Right-click it and select Remove from Inventory.