title: AutoIT Check If Process is running on Remote PC
body: <p>I currently have some AutoIT code that will terminate a process on a remote machine, but I'm needing to find a way to add a check to see if the process is running first.  After spending some time sifting through the AutoIT forums and google, I'm at a loss.  Here is what I currently have:</p>
  
  <pre><code>Func EndProc()
  $oWMIService = ObjGet("winmgmts:\\" &amp; $ipAddress &amp; "\root\CIMV2")
  
  If Not IsObj($oWMIService) Then
      MsgBox(48, "ERROR", "Couldn't locate the computer. Please make sure you've selected the correct computer and try again.")
      Return
  EndIf
  
  Dim $handle, $colProc, $cProc
  $cProc = $oWMIService.ExecQuery('SELECT * FROM Win32_Process WHERE Name = "' &amp; $ProcessToKill &amp; '"')
  
  For $oProc In $cProc
      $oProc.Terminate()
   Next
  If $handle Then
      Return $handle
  Else
      Return 0
  EndIf
  EndFunc ; Func EndProc()
  </code></pre>