I have a VM that will not shutdowna nd is hung up. When I try to shut it down with the PowerCLI 5.0.1 i get an error that says:
Operation Shutdown Gueast VM failed for vmname for the follwoing reason: Another task is already in progress.
How can I identify the task and kill it so I can reboot the VM.
If it is a task running on the vcenter you could try this:
Get-Task | where {$_.ObjectID -eq (Get-VM VMname | select -ExpandProperty Id)} | where {$_.State -eq "Running"}
That will return all the running tasks on that VM.
You can take off the last pipe to get all the tasks for that VM no matter the state.
Probably not the answer you are looking for, but if it is hung you may not be able to use the shutdown guest option. You may have to power off the VM. You can use 'Stop-VM' for that.
Thanks for the reply. I tried the stop-vm and it cannot kill the VM either with the same error.
try ssh into the host or using a vma and use the command: vmware-cmd /path to VM/ stop hard
let's us know how you get on
That did not work, but I was bale to do the following to get the VM to shutdown, i used the type=hard and the VM shutdown right away.
Connect via SSH
.vmx
configuration file, using this command:esxcli vm process list
esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber
Incase if you don't have VMA, still you can kill using esxtop from the KB article no 1014165
- On the ESXi console, enter Tech Support mode and log in as root. For more information, see Tech Support mode for Emergency Support (1003677).
- Run the
esxtop
utility using this command:esxtop
- Press
c
to switch to the CPU resource utilization screen.- 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
).- Press
k
.- At the
World to kill
prompt, type in the Leader World ID from step 6 and press enter.- Wait 30 seconds and validate that the process is not longer listed.