Well... in Win2K TS at least there are two env vars.

%CLIENTNAME%
%SESSIONNAME%

Since XP has TS built-in, it may sport the same vars. That's where the KiX macro @ProductSuite comes into play. It is best suited to ferret out whether or not the TS is "Single User Terminal Server".

I don't follow why you can't do it in KiX and just exit the script if you don't want it to run.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.