VMware Cannot Power Off VM (4 Solutions via ESXi Command)

Cannot power off VM in VMware ESXi and receive errors such as “another task is already in progress”? Try these 4 solutions to force shut down your virtual machine.

Delia

By Delia / Updated on December 14, 2023

Share this: instagram reddit

VMware ESXi: Cannot power off virtual machine

Many users running VMware ESXi host have ran into this issue: One (or more) virtual machine(s) is unresponsive and cannot be powered off or reset in any way. It is also impossible to access or unlock files on that virtual machine, edit its properties, etc. You may get messages such as:

  • Cannot power off: Another task is already in progress
  • The attempted operation cannot be performed in the current state (Powered Off)
  • The virtual machine might be performing concurrent operations…

Then how to fix these errors and power off unresponsive VM in VMware?

*This guide is mainly for VMware ESXi. For VMware Workstation, please refer to: Force shutdown Workstation VM.

vmware cannot power off vm

First thing to do: Check the power status of unresponsive VM

Before anything, it's suggested to connect to the host directly to check the status of the VM. Sometimes vCenter information about the power state may be delayed because hostd / vpxa does not passing back information.

1. Connect the vSphere Client or vSphere Web Client to VMware vCenter Server.

2. Make sure there’s no task in progress, and right-click the virtual machine to click Power off.

If you receive Cannot power Off: Another task is already in progress (1027040) or some other errors, and the virtual machine remains running, you can connect to the ESXi host directly and re-try the operation.

power off vm in client

🔹Note: If you have enabled Virtual Machine Encryption in VMware vSphere 6.5 or later versions, you must have a set of Cryptographic Operations privileges, otherwise you cannot power off the virtual machine.

If the VMware virtual machine is still running/unresponsive, you may consider force shutdown the VM as it is not desirable to reboot the entire ESXi host.

4 solutions to fix power off VM in VMware | ESXi command

To fix the error, you can power off VM via ESXi command line (manually kill the virtual machine process from ESXi Shell or PowerCLI Command Prompt). Here I listed some methods for your reference, try them one by one and see if you can power off virtual machine afterward.

✍Tips: Since there are various reasons may cause VMware cannot power off VMs, if you‘ve tried all the following and still cannot terminate them as intended, this may be caused by some more complicated factors.

In this case, you may need to reboot the ESXi host to power off all virtual machines, and migrate VMs to other ESXi with vMotion, or using a backup and restore way.

Solution 1. Power off VMware VM using vim-cmd

When you failed to power off a virtual machine in VMware, you may wonder if you can force shut it down from command line. In fact, if you are running ESXi 5.0 or later, you can use ESXCLI command to kill the VM process.

🔹Note: To use command line interface on the ESXi host, you need to enable ESXi Shell and SSH in advance.
Way 1: ESXi console > “System customization” > “Troubleshooting options” > “Enable ESXi Shell”, “Enable SSH”.
Way 2: VMware Host Client > “Manage” > “Services” > start the “TSM” and “TSM-SSH” services.

First, run this command to get a list of all registered virtual machines:

vim-cmd vmsvc/getallvms

VMware list VMs command line

Then, get the current state of a virtual machine by this command (fill in the specific VMID):

vim-cmd vmsvc/power.getstate VMID

And use the command below to shutdown the virtual machine (use the same VMID):

vim-cmd vmsvc/power.shutdown VMID

If the virtual machine fails to shut down, use this command to force power it off instead:

vim-cmd vmsvc/power.off VMID

vim-cmd power off vm

Then you can check whether the VM is actually powered off.

Solution 2. Shutdown VMware VM using process kill

In addition to the vim-cmd way, you can use another ESXCLI command to list and kill the running VM processes.

First, you need to get a list of running virtual machines by running this command:

esxcli vm process list

power off VMs command line

Then use this command to power off the virtual machine from the list:

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

After executing this command, check whether the VM is still running.

🔹Notes:

  • You need to kill the parent process of the VM first.
  • The “[soft,hard,force]” corresponds to 3 power-off modes. The “hard” mode causes an immediate shutdown.

Solution 3. Kill VM process using ESXTOP utility

Besides the above 2 methods to power off VM from ESXi command line, ESXTOP is another utility to help you kill running virtual machine process. Login into ESXi console as root to enable and launch ESXi Shell.

Then, execute this command to run the ESXTOP utility:

esxtop

Press c to switch to the CPU resource utilization screen.

Press Shift + v to limit the view to virtual machines. This may make it easier to find the Leader World ID in step 7.

Press f to display the list of fields.

Press c to add the column for the Leader World ID.

Identify the target virtual machine by its Name and Leader World ID (LWID).

esxtop leader world id

Press k.

At the World to kill prompt, type in the Leader World ID you noted down, and press Enter.

Wait for a while and check if this virtual machine is powered off successfully.

Solution 4. Quick fix for “Another task is already in progress”

Sometimes the tasks may timeout in vCenter, showing up as running on the host but failing to complete. At this point you may encounter “Cannot power off: Another task is already in progress”. If this is your case, then maybe a simple trick could save your day:

/etc/init.d/hostd restart && /etc/init.d/vpxa restart

Run this command in the ESXi host, it will restart management services without downtime or host reboot.

Prevention: Backup your VMware ESXi VMs in case of any accidents

4 solutions for VMware cannot power off VM are provided above. However, sometimes the problem is difficult to fix, forcing you to restart the ESXi host, and even recurring in the future.

For example, according to some user feedback, when booting host from a USB or SD card in ESXi 7.0u2, the virtual machine may fall into an unresponsive state and cannot be shut down.

To deal with such sudden crises, it’s highly suggested to back up VMware ESXi in advance, and regularly. If your ESXi host does go down, you can also use the backup on hand to restore the VM to another host.

Here I will use a reliable VMware backup software - AOMEI Cyber Backup as an example. It works with VMware ESXi 6.0 and above versions (free ESXi is also supported). You can easily add ESXi host or vCenter to a web console for virtual machine backup & restore, and enjoy the following benefits:

Easy-to-use: Centralized and streamlined console to help you achieve any operation with simple clicks.
Agentless: Create complete and independent image-level backup for VMware ESXi VMs.
Automation: Create schedules to automate VM backup, and enable retention policy to auto delete old backups.
Out-of-place recovery: Besides in-place recovery, you can restore a VM to new location in the same or another datastore/host/vCenter.

Click the button below to enjoy a fully-functional free trial:

Download Free TrialVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

3 simple steps to schedule backup VMware ESXi VMs:

1. Bind Devices: Access AOMEI Cyber Backup web client, navigate to Source Device > VMware > + Add VMware Device to add vCenter or Standalone ESXi host as the source device, and then click > Bind Device.

🔹Note: Once bound the host you do not need to repeat this step later.

Add VMware ESXi host

2. Create Backup Task: Navigate to Backup Task > + Create New Task, and then set the Task Name, Backup Type, Device, Target, and Schedule.

VMware ESXi backup

  • Device: Select any virtual machines you want to back up under bound ESXi or vCenter.
  • Target: Select local or network path as backup target. Used paths will be saved for handy selection.
  • Schedule: Set automatic full, incremental, or differential backup according to the frequency you specified.

3. Now you can click Start Backup and select Add the schedule and start backup now or Add the schedule only.

Start Backup

The created backups will be listed in Backup Task tab. When you want to recover them or migrate them to another location, click Restore to select any backup version you want.

Select Restore to new location and you can perform an out-of-place recovery. It will create an identical VM from the backup to the same or another host/datastore (optional), without reinstalling or configuration the new VM and applications.

restore vm to new location

Conclusion

In this article, I presented 5 fixes for VMware cannot power off VM because another task is in progress, or the operation is not allowed in current state, etc. Usually, you just need to force shutdown VMware virtual machine using ESXi command line. If all the methods don’t work, you can try to restart management services.

Be aware that these methods do not work in all cases, and failing to shut down a virtual machine is not the only problem you may encounter while using VMware ESXi. To minimize the possible loss (you may have to reboot the ESXi host), it’s best to adopt an efficient VMware backup solution beforehand to enhance risk resistance.

Delia
Delia · Editor
Delia owns extensive experience in writing technology-related blog posts, and has been a part of AOMEI since 2020 to provide expertise in data security and disaster recovery. She works with Windows operating systems, SQL databases, and virtualization platforms such as VMware and Hyper-V, specializing in troubleshooting and advising on data protection and migration.