Agreed, but I was looking at it from the point of view that the O.P. might not be aware of the significance that a computer might have more than a single TS session active on it when attempting to basically "terminate the TS session if a certain process isn't running." My statements were alluding towards the generalization of the methodology for a TS server, and to make it neutral w/respect to the user account that the specified process is running under, such as a case where the process was launched using "run as user" with alternate credentials having been supplied.
In its general form, the final script could rely solely on the TS extender and run as a native NT service that is capable of monitoring all active TS sessions on a TS server, or it could run in a user's session and perform the same functionality just for the users's TS session.