Hello all

I have been knocking my head on this issue and would love a second opinion.

So I am trying to identify if an application is running and if so, see if that process is hung or not. The remainder of the code not shown Taskkills the task if it is not responding and restarts it. That part should be working fine.

 Code:
;Define Tasklist command
   $CMDAPPCheck = '%COMSPEC% /c tasklist'

;Run Tasklist command and feed output into array
   $APPCheckOut = Split($System.Shell($CMDAPPCheck,0,3), @CRLF)

;Parse array to see if APP I want to check for is running
   $EDIRUNOutput = AScan($APPCheckOut, $EDIApp, , , 3)

;Find PID of task I am looking for
   $EDIPID = SUBSTR($APPCheckOut[$EDIRUNOutput[0]], 27, 8)

;Specify powershell command to see if pid is responding
   $CMDAPPLocked = '%COMSPEC% /c powershell (get-process -id $EDIPID).responding'

;Run powershell command and feed output into array
   $APPLockOut = Split($System.Shell($CMDAPPLocked,0,3), @CRLF)



This is where things break. When the command runs in CMD I get back True if the app is responding.

When I run the code above in KIX 4.66 on Server 2008 R2 the debug step through locks up at this point. This code seems to work fine on Windows 7.

Plan B

I tried working the same idea but with Shell %COMSPEC% /c powershell (get-process -id) ).responding >C:\temp\out.txt

this works in debug but if I package it in Kix2EXE the file C:\temp\out.txt is blank.

Any idea what I am missing?