By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

Means to use current user's credentials to autoLogon to Remote Desktop

P: n/a
Need: Auto-logon to a terminal server, start a program, and, when the user
is quits the program, auto-logoff.

Done so far: Able to use a fixed username/password in a C# program using
AxMSTSCLib and MSTSCLib. Everything in the Need, above, works just great.

Problem: All users would be logged on as the fixed username/password, so I
can't set specific printers for each user (i.e. change one, change them
all). The solution I used for this is to pass the Environment.UserName, but
the password in this case must be blank, and the user needs to enter his/her
password. Since the user is already authenticated on our network during the
Windows login, it seems that there should be some way to pass this
information to the Terminal Server. If there is no way, perhaps Microsoft
would be willing to add this feature to mstsc since there seem to be a lot
of 3rd party systems that support single logon for multiple systems (e.g.

Any ideas would be welcome,
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Hi Bill,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to pass the username of the
current user to the terminal service instead of passing a fixed username.
If there is any misunderstanding, please feel free to let me know.

Since you can already pass a fixed username, I think the current point
here, is to get the username of the current logon user. In this case, we
can use Environment.UserName property to get the user name. Use
Environment.UserDomainName to get the domain. Please check the following
link for more information.


Kevin Yu
"This posting is provided "AS IS" with no warranties, and confers no

Nov 17 '05 #2

P: n/a
Hi Bill,

I think there is some misunderstanding on my first reply. So let me clarify

Now I know that you need to pass the whole credential to the MSTSCLib. As
far as I know, we cannot do that, because the object only accepts username
and password seperately. We cannot the the password, so I think you have to
have the user type password again for security reason. HTH.

Kevin Yu
"This posting is provided "AS IS" with no warranties, and confers no

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.