Remove VMware VM Invalid State

The only method to delete this VM is to use the SSH console on the ESXi host and execute a number of commands. This implies that SSH has been enabled on the ESXi host.

Read our quick guide on “How to enable SSH on an ESXi host” if SSH is not enabled on your ESXi host.

Once ssh is enabled, connect to your ESXi host with any ssh client such as e.g Putty using your ESXi root credentials, then use the vim-cmd with the following parameters to obtain a list of the invalid VMs:

[root@foesxi06:~] vim-cmd vmsvc/getallvms | grep invalid
Skipping invalid VM ‘1223’
Skipping invalid VM ‘1276’
Skipping invalid VM ‘1341’
Skipping invalid VM ‘1480’
Skipping invalid VM ‘1699’
Skipping invalid VM ‘1705’
Skipping invalid VM ‘1743’
Skipping invalid VM ‘1794’

From the command output it is apparent that VM No.1223 is the one we are after.  As a last attempt we can try to reload the VM in hope it will rectify the problem by executing the vim-cmd vmsvc/reload command:

[root@foesxi06:~] vim-cmd vmsvc/reload 1480

Unfortunately, no joy. We now need to proceed to unregister/delete the VM using the vim-cmd /vmsvc/unregister command as shown below:

[root@esxi1:~] vim-cmd /vmsvc/unregister 8

 

Was this article helpful?

Related Articles

Leave A Comment?