VMware : How to remove invalid virtual machine from inventory

By | December 18, 2021

You may at some point end up with virtual machines marked with “Invalid” status in the vSphere Web client or vCenter.

You will also notice that the contextual menu does not show up the usual options (mostly everything is greyed out) and more importantly, the “Unregister” or “Delete” options are unfortunately unavailable.

Chill out, there is still a way of getting rid of those from your VM Inventory! Just follow the following procedure :

1. Connect to the host that currently hold the affected VM using SSH :

2. Run the following command to obtain the list of registered VM with their information ;

vim-cmd /vmsvc/getallvms

3. Locate the following output(s) message(s) :

Skipping invalid VM '1'

NOTE : Whatever is within the quote ‘ ‘ match the VM ID.

4. Unregister the VM with the following command and carefully specifying the corresponding VM ID :

vim-cmd /vmsvc/unregister 1

The VM should no longer be visible from vSphere Web Client or vCenter.