marcomangiante
Enthusiast
Enthusiast

Delete invalid virtual machine entry in web client

Jump to solution

Hello,

in a standalone esxi 6.5, during the import of a vm via web client I stopped it, so now I have an entry in the web client that point to a vmx file that doesn't exists: in the list of virtual machines in the web client I have, as virtual machine name, the path of the vm that doen't exists and in Status field the "invalid" value.

How I can delete the entry? Is it possible?

I attach an image with 2 vm, the one invalid and one valid:

esxi 6.5 webclient invalid entry.png

--

Regards

1 Solution

Accepted Solutions
e33434
Contributor
Contributor

This worked for me

vim-cmd /vmsvc/getallvms to 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

https://www.reddit.com/r/homelab/comments/708u3o/deleted_vmx_file_cannot_remove_vm_esxi/

View solution in original post

22 Replies
msripada
Virtuoso
Virtuoso

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,

MS

0 Kudos
marcomangiante
Enthusiast
Enthusiast

Hello,

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).

--

Regards

0 Kudos
msripada
Virtuoso
Virtuoso

Click on Actions -> Unregister

pastedImage_0.png

0 Kudos
skippermdj
Contributor
Contributor

If only... I have the same problem, and those options are not available:

InvalidVM.jpg

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?

0 Kudos
a_p_
Leadership
Leadership

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.

André

a_p_
Leadership
Leadership

Discussion moved from ESXi to vSphere Host Client

0 Kudos
TheBobkin
VMware Employee
VMware Employee

Hello skippermdj​ & marcomangiante​,

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.:

  <ConfigEntry id="0002">

    <objID>3</objID>

    <secDomain/>

    <vmxCfgPath>/vmfs/volumes/590cca43-c78bd3ac-1234-000c2908a466/VMware vCenter Server Appliance/VMware vCenter Server Appliance.vmx</vmxCfgPath>

  </ConfigEntry>

Copy a back-up before doing this and use vi to edit the file.

Stop vpxa and hostd before edit:

#/etc/init.d/vpxa stop
#/etc/init.d/hostd stop

restart these after edit:

#/etc/init.d/vpxa start
#/etc/init.d/hostd start

Bob

e33434
Contributor
Contributor

This worked for me

vim-cmd /vmsvc/getallvms to 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

https://www.reddit.com/r/homelab/comments/708u3o/deleted_vmx_file_cannot_remove_vm_esxi/

VMknight
Contributor
Contributor

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.

robingreen
Contributor
Contributor

This worked for me! Simple and fast.

Thank you!

0 Kudos
dodo018
Contributor
Contributor

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.

0 Kudos
one_topsy
Enthusiast
Enthusiast

Awesome!

This is the right answer

------ VCP6-DCV | Aspiring VMWare expert
0 Kudos
vannich
Contributor
Contributor

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 !

0 Kudos
marcomangiante
Enthusiast
Enthusiast

Thank you, it works like a charm: awesome solution.

0 Kudos
dlopez7892
Contributor
Contributor

This was super useful. Thank you to everyone involved for creating this topic and posting a simple resolution.

0 Kudos
sarosat
Contributor
Contributor

thanks the solution worked great !!!

0 Kudos
NRohlfs
Contributor
Contributor

Fast and easy. Worked fine for me. Thank you!

0 Kudos
bigvern75
Contributor
Contributor

Thanks

0 Kudos
britcoast
Contributor
Contributor

Thanks mate.  I figured that a could substitute a 'clean' vmx file.  I just hadn't spotted the "Skipping invalid VM###" or realised that I could force reload with vim-cmd vmsvc/reload 👍

0 Kudos