Feeding Credentials into RDP

  • Wozza

    Wozza - 2013-02-19

    Hi all, KeePass is a great utility, but I've always wanted to find a way of feeding credentials into an RDP session. Yes, I know there is a nice little plugin for Remote Desktop Manager, but this only works on the paid for version of Remote Desktop Manager and, well quite frankly I didn't want to pay for it ;)

    I've only tested this technique on a Windows 7 machine. It's not pretty, but it works.
    Create an password entry for the server you want to connect to. I've also created additional String fields in this example named DOMAIN and SERVER.
    Within the URL field type (or paste)
    cmd://"C:\Windows\System32\cmd.exe" /c cmdkey.exe /generic:TERMSRV/{S:SERVER} /user:{S:DOMAIN}{USERNAME} /pass:{PASSWORD} & mstsc.exe /v:{S:SERVER} & cmdkey.exe /delete:TERMSRV/{S:SERVER}

    This will
    1) Use cmdkey.exe to add an entry to the Windows Credential Manager then
    2) Launch RDP using mstsc.exe then
    3) Delete the entry in Windows Credential Manager using cmdkey again.

    Using this technique means that there is a command prompt window sat waiting while you are using the RDP session as cmd.exe /c will wait until each command has completed before closing, but don't worry when you have logged off of the remote computer then the command prompt will close.
    Note: If you manually close the command prompt while you are in the RDP session then the cmdkey /delete will not run.

    Hope this helps others

  • Paul

    Paul - 2013-02-21

    I use KeePass with mstsc all the time.

    1. Open mstsc and connect to the desired server.
    2. Set the mstsc window to window, not full screen.
    3. Bring up KeePass, right click on the required entry and select "Perform Auto-Type".

    cheers, Paul


Log in to post a comment.