This article provides steps for shutting down an unresponsive virtual machine from the ESXi CLI.
Symptoms:
VMware vSphere ESXi 6.5
VMware vSphere ESXi 6.7
VMware vSphere ESXi 7.0
VMware vSphere ESXi 8.0
If powering off the virtual machine from vSphere Client or Host Client will not work, you can use one of the command line methods below.
There are several methods to power off the non-responsive virtual machine using command line as the following:
Its recommended to follow the sections and steps in this article in order.
vim-cmd vmsvc/getallvms
Example output:
vim-cmd vmsvc/power.getstate VMID
vim-cmd vmsvc/get.tasklist VMID
(ManagedObjectReference) [
'vim.Task:haTask-2-vim.VirtualMachine.createSnapshot-1234567',
'vim.Task:haTask-2-vim.VirtualMachine.consolidateDisks-12345678'
]
vim-cmd vimsvc/task_info task_id
command to see the task in more detail.vim-cmd vimsvc/task_info haTask-2-vim.VirtualMachine.createSnapshot-1234567
vim.TaskInfo) {
dynamicType = <unset>,
key = "haTask-2-vim.VirtualMachine.createSnapshot-1234567",
task = 'vim.Task:haTask-2-vim.VirtualMachine.createSnapshot-1234567',
description = (vmodl.LocalizableMessage) null,
name = "vim.VirtualMachine.createSnapshot",
descriptionId = "VirtualMachine.createSnapshot",
entity = 'vim.VirtualMachine:2',
entityName = "VMware vCenter Server Appliance5-1",
state = "running",
cancelled = false,
cancelable = false,
error = (vmodl.MethodFault) null,
result = <unset>,
progress = 50,
reason = (vim.TaskReasonUser) {
dynamicType = <unset>,
userName = "********",
},
queueTime = "2014-11-09T17:49:01.171933Z",
startTime = "2014-11-09T17:49:01.175521Z",
completeTime = <unset>,
eventChainId = 1234567,
changeTag = <unset>,
parentTaskKey = <unset>,
rootTaskKey = <unset>,
}
vim-cmd vimsvc/task_cancel task_id
vim-cmd vmsvc/power.shutdown VMID
vim-cmd vmsvc/power.off VMID
Example output:esxcli vm process list
Example output:
esxcli vm process kill -t=soft -w=WorldID
or
esxcli vm process kill -t=hard -w=WorldID
or
esxcli vm process kill -t=force -w=WorldID
Killing a virtual machine using esxtop is equivalent to a forced hard shutdown with esxcli.
esxtop