Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Virtualization / VMware / Invalid State of a Virtual Machine on VMWare ESXi

March 12, 2024

Invalid State of a Virtual Machine on VMWare ESXi

Quite often, VMWare administrators are faced with the fact that the list of virtual machines contains VMs with the Invalid (Unknown) status. As a rule, the issue occurs after deleting a virtual machine, which data remained in the VMWare vSphere/ESXi configuration on some reason. This can also happen after you manually remove VM files from the VMFS storage after running vMotion and in some other cases. You won’t be able to delete such a VM from vSphere Web Client using the built-in tools (the Unregister option in the Actions menu is inactive).

vmware esxi invalid (unknown) state of vm in console
The only way to remove such a VM is to use the SSH console of the ESXi host.

  1. Enable SSH on the ESXi host with the problem VM (Actions -> Settings -> Security Profile -> Services -> SSH -> Edit -> Start); enable ssh on esxi
  2. Connect to the ESXi host using SSH client (Putty, mputty, etc.);
  3. To get the ID of the problem virtual machine, run this command: vim-cmd vmsvc/getallvms | grep invalid
  4. A list of all VMs with the Invalid status registered on this host will be displayed. There should be a string like: Skipping invalid VM '22'. In this case, 22 is the ID of the virtual machine;
  5. If you want to try and restore this VM in vSphere, run the command: vim-cmd vmsvc/reload 22 (in a minute refresh the client interface and check the VM status);
  6. If you want to unregister (delete) a problem virtual machine, run the following command: vim-cmd /vmsvc/unregister 22
  7. Refresh the vSphere client interface. The virtual machine with the Invalid status should disappear.

Also you can manually delete the problem VM from the host configuration file /etc/vmware/hostd/vmInventory.xml. To do it, delete the section containing the data of the problem VM from the vmInventory.xml file (backup the file before doing anything) in a text editor (vi, nano) and restart the host services: services.sh restart

vmInventory.xml file - vm config entry

If a running virtual machine gets the Invalid status, it is likely that the VM configuration file is corrupted. To resolve the issue:

  • Remove the VM from the inventory and restart the ESXi host;
  • Then create a new VM and connect the virtual disks (vmdk) of the old VM to it (Use an existing disk);
  • Perform Storage vMotion to collect all files of the new VM in a single folder;
  • Start your new VM and make sure that it works;
  • Delete the files of the old VM.

If the problem of the Invalid VM appeared after losing access to VMFS storages, when the access is restored the started VMs will run and the stopped ones will become isolated. You will have to manually remove them from the inventory and manually register them by finding the VMX file of a virtual machine in the VMFS storage, right-clicking it and selecting Register VM. Then start the VM and make sure that it is available.

re-register vm in vmware vsphere

11 comments
4
Facebook Twitter Google + Pinterest
VMware
previous post
Using Mandatory (Read-Only) User Profiles in Windows
next post
Managing Printers and Drivers on Windows with PowerShell

Related Reading

Adding External USB Storage Drive to VMware ESXi

December 18, 2024

Configuring iSCSI Datastore (LUN) on VMware ESXi

March 15, 2024

Adding a Sound Card to a Virtual Machine...

March 15, 2024

Windows Cannot Find the Microsoft Software License Terms

April 19, 2023

Disable Auto Suspend of VM on VMWare Workstation/Player

August 26, 2021

Match Windows Disks to VMWare VMDK Files

March 12, 2024

How to Stop an Unresponsive (Stuck) Virtual Machine...

March 15, 2024

Increasing VMFS Datastore Capacity on VMware ESXi (vSphere)

March 15, 2024

11 comments

Marlon August 10, 2019 - 6:30 am

Solved my issue within seconds. Thanks.

Reply
Diogo September 19, 2019 - 11:38 am

Thank you!

Reply
Sal October 7, 2019 - 1:18 pm

Great article, helped me during critical window

Reply
Chuck October 22, 2019 - 4:50 pm

This fixed ,my problem in 1 minute – Thank you

Reply
Matheus October 30, 2019 - 8:20 am

Thank you so musch, the first solved my problem!

Reply
Syed Arsalan Ali January 30, 2020 - 5:08 am

Thank you so much.

Reply
Paulo February 27, 2020 - 3:12 pm

this kind of article should be official on vmware KB, thank you

Reply
Prashant Sawant March 24, 2020 - 7:38 am

thanks a lot….Solved issue with this 2 command
vim-cmd vmsvc/getallvms | grep invalid
vim-cmd /vmsvc/unregister

Reply
Greg Craig May 21, 2020 - 11:07 am

Great article! Worked perfectly! Had 2 invalid VM’s on my home lag and got rid of them instantly!

Thank you!

Reply
sam May 21, 2020 - 7:09 pm

2020-05-21T17:06:16.603Z error hostd[BC40B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/5ebabd93-30fc5cf1-3290-b8aeed7fd77c/CentOS1/CentOS1.vmx opID=663195c3 user=root]

register vmx show invalid

please any help

Reply
isust November 7, 2022 - 11:48 pm

solved my problem, thanks a lot

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Match Windows Disks to VMWare VMDK Files
  • Configuring USB Devices Passthrough from VMWare ESXi to a Virtual Machine
  • Selecting the Number of vCPUs and Cores for a Virtual Machine
  • How to Enable and Configure SNMP on VMWare ESXi Host
  • How to Stop an Unresponsive (Stuck) Virtual Machine on VMware ESXi
  • Unable to Unmount/Delete VMFS Datastore: The Resource Is in Use
  • VMWare vSphere: Managing Password Expiration Settings
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top