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

  • Thread starter Thread starter Bill Struve
  • Start date Start date
B

Bill Struve

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.
Citrix).

Any ideas would be welcome,
Bill
 
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.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemEnvironmentClassUserNameTopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Bill,

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

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
rights."
 
Back
Top