How to Shutdown a VMware Virtual Machine using ESXCLI

I needed to reboot one of our ESXI hosts but couldn’t do that until I shutdown the virtual machines on the host or moved the virtual machines to another host. These weren’t critical machines so I was ok with just shutting them down instead of migrating them to another host. When I selected the Power Off option for the virtual machines, they were just stuck at 0% progress and were no longer responding. At this point, I need to forcefully shut them down.

I would recommend avoiding a forceful shut down and try to determine why the machine isn’t powering off. It could be related to backups, snapshots or some other 3rd party process.

In my case, I needed to immediately shut these machines down and wasn’t worried about any running processes or even restoring them if needed. To forcefully shut down a virtual machine, follow the steps below.

  1. Log into the host with the virtual machine in question using SSH
  2. Type “esxcli vm process list” to get the WorldID of the virtual machine you wish to power down
  3. Type “esxcli vm process kill –type=[soft,hard,force] –world-id=Number

You should always attempt ‘soft’ kills first, which will give the VMX process a chance to shutdown cleanly. If that does not work move to ‘hard’ kills which will shutdown the process immediately. ‘force’ should be used as a last resort attempt to kill the VM. If all three fail then a reboot of the ESXI host is required.

Leave a comment