Hard coding (part of) the server name(s) is something that I would not recommend because when names are change dor servers are added you need to modify the script manually. Could be a PITA.
If it is just MS TS then @TSSession would do the trick. If you have MS TS servers and ICA (Citrix) servers and need to do different things for either one of them then the SessionType UDF will work for you.

UDF Library » SessionType() - Gets the session type for the current user
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.