vSphere Host Client

 View Only
Expand all | Collapse all

Delete invalid virtual machine entry in web client

one_topsy

one_topsyOct 31, 2018 04:52 PM

  • 1.  Delete invalid virtual machine entry in web client

    Posted Feb 19, 2018 03:55 PM

    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:

    --

    Regards



  • 2.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 19, 2018 04:58 PM

    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



  • 3.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 20, 2018 04:01 PM

    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



  • 4.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 20, 2018 05:39 PM

    Click on Actions -> Unregister



  • 5.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 25, 2018 03:41 PM

    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?



  • 6.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 25, 2018 04:39 PM

    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é



  • 7.  RE: Delete invalid virtual machine entry in web client

    Posted Jan 30, 2021 02:40 PM

    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 



  • 8.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 25, 2018 06:52 PM

    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



  • 9.  RE: Delete invalid virtual machine entry in web client

    Posted Aug 08, 2023 11:21 AM

    Use /etc/vmware/hostd/vmInventory.xml for 6.5/6.7 instead



  • 10.  RE: Delete invalid virtual machine entry in web client

    Posted Feb 25, 2018 04:52 PM

    Discussion moved from ESXi to vSphere Host Client



  • 11.  RE: Delete invalid virtual machine entry in web client
    Best Answer

    Posted Mar 02, 2018 06:31 PM

    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/



  • 12.  RE: Delete invalid virtual machine entry in web client

    Posted Oct 31, 2018 04:52 PM

    Awesome!

    This is the right answer



  • 13.  RE: Delete invalid virtual machine entry in web client

    Posted Mar 15, 2018 03:08 AM

    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.



  • 14.  RE: Delete invalid virtual machine entry in web client

    Posted Mar 26, 2018 09:15 AM

    This worked for me! Simple and fast.

    Thank you!



  • 15.  RE: Delete invalid virtual machine entry in web client

    Posted May 09, 2018 08:26 PM

    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.



  • 16.  RE: Delete invalid virtual machine entry in web client

    Posted Dec 12, 2018 03:22 PM

    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 !



  • 17.  RE: Delete invalid virtual machine entry in web client

    Posted Jan 05, 2019 08:28 PM

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



  • 18.  RE: Delete invalid virtual machine entry in web client

    Posted Apr 09, 2020 12:16 PM

    thanks the solution worked great !!!



  • 19.  RE: Delete invalid virtual machine entry in web client

    Posted Sep 24, 2020 08:56 AM

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



  • 20.  RE: Delete invalid virtual machine entry in web client

    Posted Jan 19, 2021 06:18 PM

    Thanks



  • 21.  RE: Delete invalid virtual machine entry in web client

    Posted Jul 05, 2021 09:53 AM

    to be sure of what i'm doing, because i'm in production, I've done this:

    1- I made a new VM called "dummy" (ubuntu > ok>ok>ok...) no need to install sysop or anything else, only create folder and .vmx file.

    2- I went to inventory and select this VM AND the invalids VMs (I had 3 because I deleted a datastore before unregister the VMs).

    3- Now  with right click appeared "Unregister" and I unregistered all the VMs.

    4- Browsed datastore and erased "dummy" folder.

    Now inventory and datastore are clean and right.

    Very thanks !!!!

     



  • 22.  RE: Delete invalid virtual machine entry in web client

    Posted Jul 23, 2022 11:51 AM

    This is the way......

    Tnx

     

     



  • 23.  RE: Delete invalid virtual machine entry in web client

    Posted Aug 06, 2022 03:38 PM

    Thank you thank you thank you!!! This worked PERFECTLY!! If I knew you, I'd buy you a drink. I was just that frustrated with this problem and THAT elated at it being resolved!



  • 24.  RE: Delete invalid virtual machine entry in web client

    Posted Nov 14, 2022 09:43 PM

    This totally works in seconds.  Thank you for sharing that.



  • 25.  RE: Delete invalid virtual machine entry in web client

    Posted Sep 21, 2023 02:38 PM

    Yes this is the right workaround!! Great!!!! Thanks a lot



  • 26.  RE: Delete invalid virtual machine entry in web client

    Posted May 14, 2019 05:08 PM

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