Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

1 User Logging into Multiple PC terminal service session:  %clientname% environment variable doesn't update:  why?

Posted on 2007-11-20
5
Medium Priority
?
1,535 Views
Last Modified: 2013-11-21
OS:  Windows 2003 Server SP2 (with terminal services enabled).  
We are keying off the %clientname% environment variable for our application to work under terminal services.
The problem is this:
A user logs into a terminal service session from PC a.  Then the user doesn't log out of the terminal server session but creates another terminal service session from PC b.  So now the user is logged into the same terminal server 2x but with different session id's.  The problem is that the %clientname% variable doesn't update when the user logs in from PC b.  The %clientname% is still reflecting that of PC a.  

Is there a way to force this variable to update when the user logs into PC b?  Better yet is there a better variable that is unique and static to each PC?
0
Comment
Question by:carswelldp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 31

Expert Comment

by:Cláudio Rodrigues
ID: 20320160
Why do not you combine both CLIENTNAME and SESSION ID on your application? This will be definitely unique.

Claudio Rodrigues
Microsoft MVP
Windows Server - Terminal Services
0
 
LVL 1

Author Comment

by:carswelldp
ID: 20320411
Yes unique but not static.  The session id can change.
Our program has been coded to look into a folder c:\tsclient\%CLIENTNAME%\... for its configuration settings.  Each client machine has specific settings relating to it.  So the configuration cannot change and must remain static.


0
 
LVL 31

Expert Comment

by:Cláudio Rodrigues
ID: 20321141
Why you do not restrict the user to one single session? Launch TSCC.MSC and you will see the setting right there.

Claudio Rodrigues
Microsoft MVP
Windows Server - Terminal Services
0
 
LVL 1

Author Comment

by:carswelldp
ID: 20321336
I would like to do that very much.  However, the needs of our client dictate otherwise.  In this circumstance the user (according to the client) has to be logged into 2 sessions with the same userid.  I am trying to find a way around this by selecting a unique environment variable to the client terminal server session.  CLIENTNAME appeared to work wonderfully till this issue with the CLIENTNAME not being updated upon login to a different user session  while connected to the other.  I realize this may be a limitation of terminal services and in our extensive research this seems to be the case.  
0
 
LVL 31

Accepted Solution

by:
Cláudio Rodrigues earned 2000 total points
ID: 20321402
The WTSAPI returns both CLIENTNAME and the client IP address. If you use the API instead of relying on the environment variables, it will work indeed.
More information here:
http://msdn2.microsoft.com/en-us/library/aa383468.aspx

In your case you will probably be using the WTSQuerySessionInformation function.

Claudio Rodrigues
Microsoft MVP
Windows Server - Terminal Services
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found listed in my profile here: http:…
Remote Apps is a feature in server 2008 which allows users to run applications off Remote Desktop Servers without having to log into them to run the applications.  The user can either have a desktop shortcut installed or go through the web portal to…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question