PowerCLI

 View Only
  • 1.  How can stop / kill running tasks in vcenter with powercli

    Posted Jul 21, 2022 04:07 PM

    I want force stop or kill running tasks in vcenter . 

    Now when I am running follow command :

    Get-Task -Status "Running"

    it shows running tasks 

    Name ;                          state                        complete: 

    Deploy myvm               running                      0%

    Now I don't want to use variable for kill or stop tasks 

    I want use stop-task  command with task name . would you please help me about it ?



  • 2.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Jul 21, 2022 04:21 PM

    You will have to identify the Task you want to kill.
    How will you do that? Based on the Task name (like Deploy myvm)?

    If yes, you could do

    Get-Task -Status 'Running' |
    where {$_.Name -eq 'Deploy myvm'} |
    Stop-Task -Confirm:$false


  • 3.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Jul 21, 2022 04:28 PM

    Thanks . But want to now is there any solution to insert task name manually and run two command 

    first command just show current running tasks :

    Get-Task -Status 'Running'

    now with above command we can find task name then run stop-task command with task name ? such as this 

    stop-task -name "deploy testvm"



  • 4.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Jul 21, 2022 04:31 PM

    The Stop-Task cmdlet only accepts a Task object as parameter, not a name.



  • 5.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Aug 01, 2022 04:08 PM

    Sometimes we want kill a task via UI and click on task and cancel it but it usually take a few minutes and sometimes more than minutes it takes to kill can we use that command to kill it force ? Does it kill task immediately ?



  • 6.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Aug 01, 2022 04:21 PM

    The cmdlet Stop-Task does call the same API that the Web client uses, so it will take just as long.



  • 7.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Nov 06, 2022 08:41 PM

    As I find out Is that your means there is not any solution to kill  force a running process  ? Does it take same time such as cancel in the UI ?



  • 8.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Nov 06, 2022 08:49 PM

    I have no clue what you mean I'm afraid.



  • 9.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Nov 07, 2022 11:00 AM

    I want to know is there any difference if we kill a job in the UI or Kill it by Powercli ?  Because most of the time when we kill a job in the UI it will takes time and cannot kill it immediately Now want to know Will the job kill immediately (force) when we do it by Powercli ?



  • 10.  RE: How can stop / kill running tasks in vcenter with powercli

    Posted Nov 07, 2022 11:19 AM

    As I said earlier, both methods will use the same underlying API.