In the inventory, find the invalid VM -> right click -> remove from inventory or sometimes you find it under more options
On the ESXi host -> select the VM -> Actions (on the top) -> remove from inventory
Once removed from ESXi host - > the VM shows as orphaned
thanks for you reply. If I right click on the entry the only options that I have and that are not grey are "Power", "Autostart" and "Help" but they are unusable; if you see in the image that I have attached in the previous post I haven't a name of a virtual machine but the path of the datastore where there were the vmx file (that isn't exists anymore).
If only... I have the same problem, and those options are not available:
I've been at this for quite a while. Most of the solutions assume access to vSphere vCenter, but I am only running ESXI and the web client. Can't unregister or destroy this machine from CLI using vim-cmd options, so I'm at a loss. Other ideas?
This looks like an issue which definitely needs to be resolved.
As a workaround, you may:
- create a small "dummy" VM
- manually re-create the original VM's missing folder
- copy the "dummy" VM's configuration (.vmx) file to the newly created folder, and rename it to the missing file's original name
- delete the "dummy" VM
- from the host's command line run: vim-cmd vmsvc/getallvms (you should see Skipping invalid VM '###' in the command's output)
- from the host's command line run: vim-cmd vmsvc/reload ### (where ### is the number from the previous command's output)
After a "Refresh" in in the VM view in the Web GUI, you should see a "dummy" VM which you can now delete.
You should be able to permanently remove any inventory reference to this VM by removing the five lines that refer to this entry in /etc/inventory/hostd/vmInventory.xml e.g.:
<vmxCfgPath>/vmfs/volumes/590cca43-c78bd3ac-1234-000c2908a466/VMware vCenter Server Appliance/VMware vCenter Server Appliance.vmx</vmxCfgPath>
Copy a back-up before doing this and use vi to edit the file.
Stop vpxa and hostd before edit:
restart these after edit:
7 people found this helpful
This worked for me
vim-cmd /vmsvc/getallvmsto list all registered VMs
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
vim-cmd /vmsvc/unregister <id>to unregister that VM.
This solution was from the following
7 people found this helpful
I just had this issue as well. After an hour or 2 I found the solution!
Select the check box of the one "you want to delete" and a "powered on VM" select Actions on top, it should be something you can finally select now. Now select unregister it will notify you that both vms will be removed. But actually only the one vm (or path of that vm\.vmx at the end of the naming convention) you want will be removed because it is powered off. Let me know if this works for you. Or to be safe stand up a test VM and leave it powered on as your second VM. Good luck, let me know if this works for you.
This worked for me! Simple and fast.
Thanks! These instructions worked exactly as detailed. I only have an ESXi 6.5 that had this problem from before I've looked at it.
This is the right answer
Very well done. Looking for a solution since months ('cause I had no time to work on it), and it was a 10 secs fix thanks to you. Thanks dude !
Thank you, it works like a charm: awesome solution.