I have not tested this personally as I don't have a Terminal Server environment, but another member posted the code, and I converted it to a UDF... please follow up and say if this works for you. If so, I'll post this to the UDF Forum.

Clientname() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=202786#Post202786

*Requires*
GetSessionID() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=137632#Post137632

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1