Forum Discussion

m_essaid's avatar
m_essaid
Valued Contributor
7 years ago

Terminate TestExecute process by batch

Hi there,

 

Sometimes, the night tests don't run because TestExecute is already running.

Of course, I put the "/quit" parameter when I call TestExecute with the scheduller.

But randomly, a previous instance of TE exists and it freezes the VM.

 

Could I terminate an eventual process of TE by any way (.bat, powershell script) before everytime I launch TE with the scheduller ?

 

Thank you in advance,

 

Mehdi

  • Sometimes if a previous instance is stuck, running TestExecute again will start  a new instance and you can end up with multiple instances

     

    Try a powershell script as its more reliable and powerful, and gives you more control.

     

    Script should search for all running instances of TestExecute, Kill all instances and then verify that no more instances are running.

    • m_essaid's avatar
      m_essaid
      Valued Contributor

      hi karkadil,

       

      When I use a console in the appropriate mode (admin privileges) it says that the process with the correct PID has been terminated correctly.

      But it don't terminate anything... TE still in the processes list.

  • HD's avatar
    HD
    Contributor

    Sometimes if a previous instance is stuck, running TestExecute again will start  a new instance and you can end up with multiple instances

     

    Try a powershell script as its more reliable and powerful, and gives you more control.

     

    Script should search for all running instances of TestExecute, Kill all instances and then verify that no more instances are running.

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    Hi guys,

    Finally I used this Powershell script :

     

    $testexecute = Get-Process testexecute -ErrorAction SilentlyContinue
    if ($testexecute) {
      if (!$testexecute.HasExited) {
        $testexecute | Stop-Process -Force
      }
    }
    Remove-Variable testexecute

     

    which works fine. I launch the ps1 file with the Task Scheduler with admin privileges.

     

    Thank you all !