Simon White
Simon White

Reputation: 11

How to force MSTSC.exe to use the supplied password?

I would like to automate the login to a terminal server using Remote Desktop. In the past you could create an RDP file and open it to launch a connection. However, with the changes in security the password in the RDP file is now ignored and the user is prompted to enter it. I want to avoid this prompt and have the session launched automatically. I do not have access to the workstations using the Remote Desktop Connection so I cannot save the password ahead of time. I was thinking of building a small exe which would be downloaded from a web server to automate this process but cannot find any information on how to handle the password. Does anyone know how I can get mstsc.exe to use the password I supply?

Thanks Simon

Upvotes: 1

Views: 2679

Answers (2)

Dennis
Dennis

Reputation: 1784

You can use cmdkey.exe to cache the password to be used with different network connections.

See stackovervlow - login to remote using "mstsc /admin" with password

Upvotes: 0

kbrimington
kbrimington

Reputation: 25642

I really quite like the Terminals application from CodePlex (http://terminals.codeplex.com). I've been using it for about a year now to manage all the connections to my servers. This application allows me to store my credentials for any connection, which are encrypted using my secret "master password" as the key.

At any rate, it automates my login. I just click on whichever connection I want, and it loads it in a new tab within Terminals.

Now, you may find that an application such as Terminals meets your needs. If, instead, you want to go even further with the automation and really take control of a terminal services client, you may be interested in the source code of Terminals.

The project references a COM library that contains a component that is a complete terminal services client. The RDPConnection class is a reasonable example of using this client to connect/disconnect, copy files, and handle errors with the component. You can take a look at the class and sort out the relevent details for your effort.

Good luck!

Upvotes: 2

Related Questions