I've created one RDP file

full address:s:

When I open this file it still asks me for the password. What can I do to tell RDP client to use password mentioned in the file instead of asking user?

7 Answers 7


I had the issue on Windows 10 with perma asking password when I try to connect to a new machine.

First, the password line in the RDP must be named:

password 51:b:myEncryptedPassword

And the pass must by encrypted. You can use cryptRDP5 to convert it: https://github.com/jps-networks-modifiedOSS/openvpn-als-applications/tree/master/adito-application-rdp-xplatform-embedded/src/windows

cryptRDP5.exe yourpassword

Note that the generated password is only valid for the machine that did it.

Note 2: cryptRDP5 don't seems to parse correctly a password containing an apostrophe character ' Better to use Powershell as suggested in comments.

  • 4
    I found that Powershell's ConvertFrom-SecureString also works instead of needing that cryptRDP5.exe
    – jtb
    Feb 27, 2019 at 23:03
  • 25
    For reference, the full powershell command to encrypt a password using the above would be ("MySuperSecretPassword!" | ConvertTo-SecureString -AsPlainText -Force) | ConvertFrom-SecureString; Mar 7, 2019 at 20:36
  • 3
    Is there a linux/osx equivalent of cryptRDP5.exe? Jul 9, 2019 at 0:25
  • @BrainSlugs83 Note that it doesn't fully match rdp encryption which pads the password with zero bytes to be 512 bytes before encryption.
    – NetMage
    Aug 24, 2020 at 20:38
  • 1
    cryptRDP5.exe MySuperSecretPassword gives a different result from the example in the second comment. In particular, the result from cryptRDP5.exe works, and the one from ConvertFrom-SecureString doesn't. Why is that?
    – Saturnix
    Dec 19, 2020 at 22:50

Open the Group Policy editor (Start > Run > gpedit.msc) and navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Connection Client

For value Do not allow passwords to be saved, check that is set to Disabled.

When connecting to a machine in Remote Desktop Connector, expand the Options panel and confirm that Allow me to save credentials is checked.

  • 1
    I've disabled the value as per your suggestion but it still asks for my password. Aug 14, 2017 at 6:24
  • This works only in case the password is encrypted/hashed. For plaintext password, it does not work. Is there any other policy which I've to check for this? Aug 14, 2017 at 12:37

Try adding

prompt for credentials:i:0
  • 1
    Have tried that but still asks me for my password. Aug 9, 2017 at 16:22
  • Check the message that it gives to you. Maybe a GPO is blocking you to login withouth giving creds Aug 9, 2017 at 16:26
  • It's not giving any message saying GPO is blocking the login. Aug 14, 2017 at 6:24
  • 3
    Thanks, worked for me in combination with username:s:myuser and password 51:b:myEncryptedPassword.
    – Artem
    May 22, 2019 at 20:49

I didn't managed to do this by modifying the .rdp. But a workaround is, to change the settings of the remote desktop connection application. In Preferences -> User Accounts you can add your account + password:

enter image description here

  • That appears to be for MacOS, not Windows.
    – NetMage
    Aug 24, 2020 at 19:55
  • I asume that a similiar option might be in windows version of this Microsoft product available, too. The main trick is not to modify the rdp file, but to put it in the Remote Desktop app preferences.
    – DracoBlue
    Aug 24, 2020 at 19:57
  • Windows doesn't have app preferences.
    – NetMage
    Aug 24, 2020 at 20:02
  • this worked for me on macos thank you
    – lenz
    Sep 14, 2021 at 16:54

I had to do all these three steps to make it not prompt for password when trying to connect using the .rdp file.

  1. Open the .rdp file in a text editor and look for the line prompt for credentials:i:1. Change the last 1 to a 0, like so prompt for credentials:i:0

  2. Generate encrypted password using this PowerShell command:

    ("MySuperSecretPassword" | ConvertTo-SecureString -AsPlainText -Force) | ConvertFrom-SecureString;
  3. Add a line like this password 51:b:MyEncryptedPassword in the .rdp file.

Now connecting using the .rdp file should not prompt for the password.


To enable the setting, the user can enter promptcredentialonce:i:1 in the RDP file.

If the user wants to disable the setting, then user can enter promptcredentialonce:i:0 in the RDP file.


Here is a Python 3 program that inserts username/password into RDP file and also creates LNK file for it (to drag to quick launch, for example). It is based on several existing solutions, credits for those goes to their authors.

import sys, os, getpass, subprocess

if (len(sys.argv) != 2):
    print("\nRDPPassword is a Python 3 program that inserts username")
    print("and password into existing RDP file and creates a LNK file")
    print("that can be dragged to taskbar's QuickLaunch area.")
    print("\nUSAGE: python %s <RDP file>\n" % os.path.basename(sys.argv[0]))

def InsertPassword(rdpfile, user, password):
    fileIn = open(rdpfile, "r", encoding="'utf_16_le")
    lines = fileIn.read().splitlines()
    outLines = []
    bPromptCredentials = False
    bUsername = False
    bPassword = False
    for line in lines:
        if line.startswith('promptcredentialonce:i:'):
            bPromptCredentials = True
        elif line.startswith('username:s:'):
            outLines.append('username:s:%s' % user)
            bUsername = True
        elif line.startswith('password 51:b:'):
            outLines.append('password 51:b:%s' % password)
            bPassword = True
        elif len(line)>0:
    if not bPromptCredentials:
    if not bUsername:
            outLines.append('username:s:%s' % user)
    if not bPassword:
            outLines.append('password 51:b:%s' % password)
    fileOut = open(rdpfile, "w", encoding="utf_16_le")
    for line in outLines:
        #fileOut.write("%s%s" % (line, os.linesep))
        fileOut.write("%s%s" % (line, '\n'))

def RunShell(command):
    # pipes usage taken from: https://superuser.com/questions/1540516/how-do-i-execute-powershell-commands-with-pipes-in-python
    PSEXE = r'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
    PSRUNCMD = "Invoke-Command -ScriptBlock "
    process = subprocess.run([PSEXE, PSRUNCMD + "{" + command + "}"], stdout = subprocess.PIPE, stderr = subprocess.PIPE, universal_newlines = True)
    #print("CMD", command)
    #print("ERR", process.stderr)
    #print("OUT", process.stdout)
    return process.stdout

if not os.path.exists(sys.argv[1]):
    print("\nFile '%s' not found.\n" % sys.argv[1])

if not ( (sys.argv[1].endswith(".rdp")) or (sys.argv[1].endswith(".RDP")) ):
    print("\nFile '%s' not a RDP file.\n" % sys.argv[1])

print("\nInserting username/password into '%s'" % sys.argv[1])
username = input("Username: ")
#password = getpass.getpass("Password: ") #use this if you do not want the password to be seen while typing
password = input("Password: ")

# insert username/password into RDP file
# **************************************
# RDP password generation taken from: https://serverfault.com/questions/867467/rdp-file-with-embedded-password-asks-for-password
PassCmd = "('%s' | ConvertTo-SecureString -AsPlainText -Force) | ConvertFrom-SecureString;" % password
password = RunShell(PassCmd)

InsertPassword(sys.argv[1], username, password)

# create a LNK file for RDP
# *************************
print("\nCreating a LNK file for '%s'" % sys.argv[1])
# https://superuser.com/questions/298974/how-do-i-pin-a-remote-desktop-connection-to-the-taskbar
RunRdp = r'"%windir%\system32\mstsc.exe"'
RunArgs = "'\"%s\"'" % os.path.abspath(sys.argv[1])
# https://superuser.com/questions/392061/how-to-make-a-shortcut-from-cmd
LnkCmd = '$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut("%s"); $S.TargetPath = %s; $S.Arguments = %s; $S.Save()' % (sys.argv[1][:-3]+"lnk", RunRdp, RunArgs)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .