13
2
I want to open a remote desktop connection directly from a shortcut, and I want to embed the username password within the shortcut.
How do I get the path of a remote desktop from an RDP shortcut, and can we set password in an RDP shortcut?
13
2
I want to open a remote desktop connection directly from a shortcut, and I want to embed the username password within the shortcut.
How do I get the path of a remote desktop from an RDP shortcut, and can we set password in an RDP shortcut?
12
When saving the RDP file, check off the Save my password checkbox. This will save your password to the .RDP
file in an encrypted format. Be careful though, as people have found out how to decrypt it:
how to add password manually to open RDP file in note pad – metal gear solid – 2010-02-28T17:33:03.343
This is not a problem anymore with MSTSC v6 - the credentials are stored elsewhere on the system (Local Settings\Application Data\Microsoft\Credentials), and as far as I know, they are encrypted with the user's login password. – user1686 – 2010-02-28T18:39:14.200
I already have RDP file. I want to edit the file and insert password – metal gear solid – 2010-03-01T03:16:27.663
@Jitendra the file stores the password in an encrypted format, it's not as simple as opening it and typing password:abc123
. If you can find a tool to encrypt them into that format then you can, but I doubt somebody would bother making such a tool. – John T – 2010-03-01T06:09:11.623
There is no option to enter/save password in Windows 7. Can you help? – digitguy – 2014-04-14T04:33:41.077
5
Try editing the .rdp files directly. I found an article, How rdp passwords are encrypted, saying how, and deep down, in the posts, there is some code for how to do this in C# too:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Security.Cryptography;
using System.Linq;
using System.Text;
class Mstscpw
{
private const int CRYPTPROTECT_UI_FORBIDDEN = 0x1;
// Wrapper for the NULL handle or pointer.
static private IntPtr NullPtr = ((IntPtr)((int)(0)));
// Wrapper for DPAPI CryptProtectData function.
[DllImport("crypt32.dll", SetLastError = true,
CharSet = System.Runtime.InteropServices.CharSet.Auto)]
private static extern bool CryptProtectData(
ref DATA_BLOB pPlainText,
[MarshalAs(UnmanagedType.LPWStr)]string szDescription,
IntPtr pEntroy,
IntPtr pReserved,
IntPtr pPrompt,
int dwFlags,
ref DATA_BLOB pCipherText);
// BLOB structure used to pass data to DPAPI functions.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct DATA_BLOB
{
public int cbData;
public IntPtr pbData;
}
private static void InitBLOB(byte[] data, ref DATA_BLOB blob)
{
blob.pbData = Marshal.AllocHGlobal(data.Length);
if (blob.pbData == IntPtr.Zero)
throw new Exception("Unable to allocate buffer for BLOB data.");
blob.cbData = data.Length;
Marshal.Copy(data, 0, blob.pbData, data.Length);
}
public string encryptpw(string pw)
{
byte[] pwba = Encoding.Unicode.GetBytes(pw);
DATA_BLOB dataIn = new DATA_BLOB();
DATA_BLOB dataOut = new DATA_BLOB();
StringBuilder epwsb = new StringBuilder();
try
{
try
{
InitBLOB(pwba, ref dataIn);
}
catch (Exception ex)
{
throw new Exception("Cannot initialize dataIn BLOB.", ex);
}
bool success = CryptProtectData(
ref dataIn,
"psw",
NullPtr,
NullPtr,
NullPtr,
CRYPTPROTECT_UI_FORBIDDEN,
ref dataOut);
if (!success)
{
int errCode = Marshal.GetLastWin32Error();
throw new Exception("CryptProtectData failed.", new Win32Exception(errCode));
}
byte[] epwba = new byte[dataOut.cbData];
Marshal.Copy(dataOut.pbData, epwba, 0, dataOut.cbData);
// Convert hex data to hex characters (suitable for a string)
for (int i = 0; i < dataOut.cbData; i++)
epwsb.Append(Convert.ToString(epwba[i], 16).PadLeft(2, '0').ToUpper());
}
catch (Exception ex)
{
throw new Exception("unable to encrypt data.", ex);
}
finally
{
if (dataIn.pbData != IntPtr.Zero)
Marshal.FreeHGlobal(dataIn.pbData);
if (dataOut.pbData != IntPtr.Zero)
Marshal.FreeHGlobal(dataOut.pbData);
}
return epwsb.ToString();
}
}
// Test code:
class program
{
static void Main(string[] args)
{
Mstscpw mstscpw = new Mstscpw();
string epw = mstscpw.encryptpw("password");
Console.WriteLine("Encrypted password for \"password\" {0} characters: \r\n{1}", epw.Length, epw);
Console.ReadLine();
}
}
2
Remote Desktop Plus from Donkz.nl.
Feature #1:
Login automatically from the command line.
Example:
rdp /v:nlmail01 /u:administrator /p:P@ssw0rd! /max
0
Well, partially correct, you cannot really edit the Microsoft Credentials easily, and the command is not rdp
, but if you run the command mstsc
it will correct the 'save password' issue on WinXP.
Access Remote Desktop Via Commandline
mstsc [<connection file>] [/v:<server[:port]>] [/admin] [/f[ullscreen]] [/w:<width>] [/h:<height>] [/public] | [/span] [/edit "connection file"] [/migrate] [/?]
Just open a CMD window, type mstsc
, put in the PC name or IP, click Options, and go on your merry way, but do a Save As... so you have a working shortcut for later.
0
Alternativly create a batch script (.bat) with the following lines:
cmdkey /generic:"computername or IP" /user:"username" /pass:"password"
mstsc /v:"computer name or IP"
Note replace the IP, username and password in the script with the valid credentials.
Now run the script by simply double clicking on it.
This works.
answer available in steps at : http://stackoverflow.com/a/40017890/4361073
– parasrish – 2016-10-13T14:31:17.050