I'm trying to add or save Remote Desktop Protocol (RDP) credentials using the command line on Windows. I understand that the cmdkey utility can be used for this purpose, but I'm not entirely sure how to use it correctly.
Could someone provide a step-by-step guide on how to add/save RDP credentials using cmdkey or any other command line method?
I'm trying to add or save Remote Desktop Protocol (RDP) credentials using the command line on Windows. I understand that the cmdkey utility can be used for this purpose, but I'm not entirely sure how to use it correctly.
Could someone provide a step-by-step guide on how to add/save RDP credentials using cmdkey or any other command line method?
Share Improve this question asked 2 hours ago Pramod LawatePramod Lawate 1,0311 gold badge11 silver badges27 bronze badges1 Answer
Reset to default 0To add Remote Desktop Protocol (RDP) credentials through the command line so that you are not prompted for them in the future, you can use the cmdkey command to store the credentials. Here is how you can do it:
- Open Command Prompt with administrative privileges.
- Use the following command to add the credentials:
cmdkey /generic:TERMSRV/ /user: /pass:
Replace with the name or IP address of the remote machine, with your username, and with your password. For example, if your remote machine's IP address is 192.168.1.100, your username is user1, and your password is password123, the command would be:
cmdkey /generic:TERMSRV/192.2.1.100 /user:user1 /pass:password123
This will store the credentials for the specified remote machine. The next time you connect to this machine using Remote Desktop, it should not prompt you for credentials. Note: Storing passwords in plain text can be a security risk. Ensure that you handle credentials securely and consider using more secure methods if possible.
To list available credentials:
cmdkey /list cmdkey /list:targetname
To create domain credentials:
cmdkey /add:targetname /user:username /pass:password cmdkey /add:targetname /user:username /pass cmdkey /add:targetname /user:username cmdkey /add:targetname /smartcard
To create generic credentials:
The /add switch may be replaced by /generic to create generic credentials
To delete existing credentials:
cmdkey /delete:targetname
To delete RAS credentials:
cmdkey /delete /ras