Powering off a virtual machine on an ESXi host


To totally unlock this section you need to Log-in


Login

Powering off a virtual machine on an ESX/ESXi host, you experience these symptoms:

  • You cannot power off an ESXi hosted virtual machine
  • A virtual machine is not responsive and cannot be stopped or killed
  • Resetting the VM hangs with "In Progress..." message

ESXCLI Approach

The esxcli command can be used locally or remotely to power off a virtual machine running on ESXi 5.x or later.

Open a console session where the esxcli tool is available, either in the ESXi Shell, the vSphere Management Assistant (vMA), or the location where the vSphere Command-Line Interface (vCLI) is installed.
Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file by running this command:

esxcli vm process list

Power off one of the virtual machines from the list using this command:

esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber

Notes: three power-off methods are available. Soft is the most graceful, hard performs an immediate shutdown, and force should be used as a last resort.

Alternate power off command syntax is: esxcli vm process kill -t [ soft,hard,force] -w WorldNumber.

Repeat the above procedure and validate that the virtual machine is no longer running.

For ESXi 4.1:

Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file by running this command:

esxcli vms vm list

Power off one of the virtual machines from the list by running this command:

esxcli vms vm kill --type= [soft,hard,force] --world-id= WorldNumber

Using the ESXi command-line utility vim-cmd to power off the virtual machine

Get a list of all registered virtual machines, identified by their VMID, Display Name, and path to the .vmx configuration file by running this command:

vim-cmd vmsvc/getallvms

Get the current state of a virtual machine by running this command:

vim-cmd vmsvc/power.getstate VMID

Shutdown the virtual machine using the VMID found in previous step and run this command:

vim-cmd vmsvc/power.shutdown VMID

Note: If the virtual machine fails to shut down, run this command:

vim-cmd vmsvc/power.off VMID