Supply username and password to mstsc

36,735

Solution 1

I still have connection files with saved passwords that were saved and they still work.

The .rdp format is actually fairly decently documented, see these:

http://support.microsoft.com/kb/885187

http://asptutorials.net/windows/remote-desktop-connection-rdp-files/

Some documentation about the password hashses is at:

http://www.remkoweijnen.nl/blog/2007/10/18/how-rdp-passwords-are-encrypted/

Solution 2

  1. Open Powershell
  2. type ("YourPassword" | ConvertTo-SecureString -AsPlainText -Force) | ConvertFrom-SecureString;
  3. Add the resulting hash to the rdp file as password 51:b:<hash>

Note: This hashes the password per user, so sharing the rdp file with someone else means it wont work.

(11 year old question, but answering for future visitors)

Share:
36,735

Related videos on Youtube

Matheus Portela
Author by

Matheus Portela

Updated on September 17, 2022

Comments

  • Matheus Portela
    Matheus Portela over 1 year

    In previous versions of the remote desktop client there were methods of passing in the password through various methods. Has anybody found a good method using the latest remote desktop client? I'm aware of LaunchRDP but that doesn't meet our needs.

    Perhaps somebody knows the algorithm so I can dynamically assemble RDP connection files?

  • Matheus Portela
    Matheus Portela almost 15 years
    Yes, but that's not what I'm asking. I need to be able to dynamically assemble rdp connection files via a script.
  • Matheus Portela
    Matheus Portela almost 15 years
    Thank you for your help, but neither of these articles help. What I'm looking for is to how to generate the password hash that is used in the RDP files on the fly OR launch remote desktop with the password through command line options.