Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

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

September 15, 2022 VMWare

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
2
Facebook Twitter Google + Pinterest
previous post
Using Mandatory (Read-Only) User Profiles in Windows 10
next post
Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016

Related Reading

Reset Root Password in VMware ESXi

October 12, 2023

How to Fix ‘An Operating System Wasn’t Found’...

July 14, 2023

Unmounting an NFS Datastore from VMware ESXi

April 21, 2023

How to Increase Virtual Machine Disk Size in...

April 6, 2023

How to Install Free VMware Hypervisor (ESXi)

January 24, 2023

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

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • ESXi: Slow Disk Performance on HPE Gen8
  • Windows Server Licensing for Virtual Environments
  • Match Windows Disks to VMWare VMDK Files
  • System Logs on ESXi Host are Stored On Non-Persistent Storage
  • 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?
Footer Logo

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


Back To Top