How to cancel a hang task in vCenter or ESXi host?

Posted on Updated on


Sometime we may need to cancel an hung task like active vmotion/backup which may show as disabled from the vSphere client.

  1. First check if there is an active task running for the VM in the Task and Events Tab.
  2. Log in to ESXi host via SSH (using e.g. putty). If the SSH service is not running on ESXi host, please enable it.
  3. Run ps command. use grep e.g. ps | grep VM_name
  4. Kill the parent process by running the command kill id_parent e.g. kill 859467
  5. The hang task should be canceled now and will reflect in the Tasks and Events in the vCenter.

 

Advertisements

3 thoughts on “How to cancel a hang task in vCenter or ESXi host?

    Anthony Junk said:
    January 25, 2017 at 10:22 pm

    Do not do this, this is a horrible suggestion without at least caveating what it does. The above command in step 3 will kill the VM — stop it cold. This will likely corrupt most systems and should only be done if you either are: 1) planning to restore from backup or 2) want to get rid of the vm anyways.

    Like

    Mehrantgs said:
    May 1, 2017 at 5:05 pm

    it is better to proceed via powercli:
    connect to vcenter or host by:
    connect-VIServer [vcenter_ip]
    find it by :
    get-task -Status running | select ID, StartTime, IsCancelable| fl
    kill it by:
    Get-Task | where {$_.id -eq “Task-task-33529” } | stop-task -confirm:$false

    Like

    misdemeanor said:
    August 11, 2017 at 8:46 pm

    @Mehrantgs this will only “kill” or factually cancel a task if the task itself is cancelable. It will not end a task such as a Remidiation task within the Update Manager.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s