I think it should be $xen. It should be filled by some code in your script before trying to use it.

I use the SessionType() UDF for this. Check: UDF Library » SessionType() - Gets the session type for the current user
This UDF will check if you are on RDP, ICA (Citrix) or a console session.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.