Shutdown ESXi host over SSH


Shutdown ESXi host over SSH

  1. Connect ESXi host over SSH
  2. Get a list of running virtual machines, we will use the [World ID] later.
esxcli vm process list
  1. Power off the virtual machines one by one from the list
esxcli vm process kill --type=[soft, hard, force] --world-id=[World ID]
  1. Shutdown VMs and Power off ESXi Host
/sbin/ && /sbin/poweroff

[Alternative]Power off/on a virtual machine with command-line utilities

  1. List VMs
vim-cmd vmsvc/getallvms
  1. Get the power state of a VM
vim-cmd vmsvc/power.getstate <Vmid>
  1. Power on a virtual machine
vim-cmd vmsvc/ <Vmid>