How to remove a locked VM

I was asked by one of my clients to look at a locked VM that couldn’t be powered off, deleted, edited, vMotioned or otherwise altered from its current state.

locked VM

As the client wasn’t able to do some basic troubleshooting steps such as evacuating the host, restarting services or rebooting hosts due to current restrictions in the environment, I was asked what could be done to ‘unlock’ the VM so it could be edited or deleted.

This was a vCenter 5.5 with ESXi 5.1 hosts but the procedure below should work on all versions of ESXi.

Firstly, identify the host the VM is currently residing on:

VM Summary
…and enabling SSH access to that host:

Enable SSH

…and then SSH into that host.


After logging in, issue the command:

esxcli vm process list

This will list the VMs on the host and most importantly the VM’s World ID and its storage location of the VMX File.

After confirming that the VM is the one with the issue, you can power off the VM with the command:

esxcli vm process kill -t [soft,hard,force] -w WorldNumber

so for example:

esxcli vm process kill -t hard -w 123456789


  • Soft = Graceful
  • Hard = Immediate shutdown
  • Force = Nuclear option

Once the VM has been powered down, you can then remove it from the vCenter inventory. A clean-up operation was then completed on the files to free up the storage (By taking the path name taken from the esxcli output and removing the files and folder).

As this environment has HA enabled, it did trigger HA to try and bring the VM up on another host.


In our case it failed to do so (Not unexpected), so after reviewing KB2004802, HA was turned off and re-enabled which resolved the warning (vSphere HA initiated machine failover action in cluster {X} in datacenter {X}).


Be First to Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.