VMware ESXi 6.5 – How to remove invalid virtual machine in web client
Recently I encountered an issue with VMs and it took some time to resolve, hence thought of sharing this steps with regard to invalid/orphaned virtual machine.
To remove it from inventory in ESXi web client, but unregister was grayed.
The solution is use cli… so connect to your esxi host and use:
vim-cmd /vmsvc/getallvmsto list all registered VMs
vim-cmd /vmsvc/unregister <id>to unregister that VM.
get the ID of the VM you removed the files for (the first column of output). Mine said invalid vm skipped but showed the ID – in my case 60;61;71;72;80;83;89;97
[root@xxxxxxx2-esx2:~] vim-cmd /vmsvc/getallvms Skipping invalid VM '60' Skipping invalid VM '61' Skipping invalid VM '71' Skipping invalid VM '72' Skipping invalid VM '80' Skipping invalid VM '83' Skipping invalid VM '89' Skipping invalid VM '97' [root@xxxxxxx2:~] vim-cmd /vmsvc/unregister 60
This will help you clean your Virtual machine in the Web Client, Same is applicable for Esxi 6.7 as well.