troubleshooting Question

Get the client name for a Terminal Services Session in a program

Avatar of allanmce
allanmce asked on
Windows Server 2003Microsoft Server OSEditors IDEs
9 Comments2 Solutions4319 ViewsLast Modified:
I am trying to get a reliable client name in a program for a Windows 2003 server terminal services session. (I am using Delphi but the question is really a Terminal Services question rather than a Delphi question). I read the environment variable 'CLIENTNAME' which works well most of the time but I have discovered the following problem.

If users log in on the SAME USER NAME so that there are multiple TS sessions under the same user name then even though they are logging from different computer names the 'CLIENTNAME' variable in all the sessions is set to the same value (the first or last one logged in I assume, I haven't checked in detail).

Is there a way around this so that the correct machine name or client name of the logged in user of the session that is running the program can be derived by the program, even for multiple logins for the same user name?

Any help would be gratefully appreciated.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros