No announcement yet.

ClientName Env Var doesn't refresh

  • Filter
  • Time
  • Show
Clear All
new posts

  • ClientName Env Var doesn't refresh

    Hi guys,

    I am sure this is the place to get this resolved, so:

    We are running WinServStd 2003 with TS (CAL 50). I suggest to everybody the box we use it with, 4GB + Dual Xeons. Flies, like a jet.

    Now the problem.

    We run an appliaction that requires the user to identify the PHYSICAL location of its client for selecting the appropriate printer. Since we had a LOT of crashes of the PrintSpooler due to 3rd party non-TS-compatible printer drivers, we do NOT do it using TS session printer sharing. We use the standard MS File and Print Sharing (common name SAMBA) protocols. Our network is still local for the clients, but it doesn't have enough bandwidth, to have them run the application directly (fat client). Hence, TS.

    Now the problem is like this.

    User1 logs into locally to Station1. Using RDP logs into TS_Server1. Starts his application and works fine.
    Some time into his work, he is told to switch stations (Standard Business Rule).
    User1 then abandons his station (no log out of TS_Server1 or local) and walks over to Station2. (This we could criticize, but my IT department is supposed to support my users, even when they break all the rules :--) ).
    Now User1 logs into Station2 and using RDP he logs into TS_Server1. (Notice, he is going to take over his LIVE session on TS_Server1.) The application will of course NOT know about this, and will have the user registered to the wrong station, i.e. the application is going to print on the "wrong" printer.
    Now, using the CLIENTNAME environment variable we could always know where the client 'REALLY' is coming from, and 'teach' the application to verify that and print to the 'right' printers.
    This would be great, but based on our testing the CLIENTNAME variable is not changing when you connect to your LIVE session from another client, it only gets initialized at first LOG IN.
    Interestingly and as a matter of course, the TS Manager Session tab shows exactly the client (NO MISTAKE ABOUT it, the TS Manager knows who is your daddy :--) ). How can I force the CLIENTNAME variable to be evaluated again or set again, so that reading that will provide as the accurate information.
    Thanks for you help everybody.

  • #2
    Re: ClientName Env Var doesn't refresh

    The simple thing is to teach users to use only one TS session at time:
    Best Regards,

    Yuval Sinay

    LinkedIn:, Blog:


    • #3
      Re: ClientName Env Var doesn't refresh


      thanks for the reply, although that's not an answer. An IT pro cannot answer an IT problem with HR ideas This is corporate America, IT is here to support.

      Now as far the two article goes the first one tells us how to limit a user to one connection. A careful reading of my posting will tell you that we already had this checked. That's why they actually take over their session from the other computer.
      Maybe the opposite would be somewhat of a solution, opening a new session for them. However I feel that this is not the best move either.

      As far as the second article goes, that is just a plain confirmation of the problem. Which, I know exists anyway, hence my posting.

      All in all, not much new information there. The interesting thing is though, that as I said earlier, the Terminal Services Manager will know the correct client name, and so if there would be a script I could use to read the client name from there, I could fix the environment variable in a simple way.

      Any help towards that directon?