I have a KiXtart script which is a front-end to an application (we'll call it, 'X'). It first detects if 'X' is already opened. If it is, it terminates, else it launches.

In single-session, client workstations, my KiXtart script works fine. But in Terminal Server, the UDF, 'EnumProcess' seems to enumerate from a master list of all processes running on the server (including processes from other sessions).

Is there a way to control the enumeration to only enumerate within the process list of the active session? Any thoughts?