0

I can't seem to get RDP credentials to store in the credential manager.

I started with something like this:

CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri("TERMSRV//RemoteMachine"), "Digest", new NetworkCredential(username, password, domain));

It was upset about the Uri and I couldn't figure out the magic syntax.

Finally, I got to this:

NetworkCredential theNetworkCredential = new NetworkCredential(@"domain\username", "password");
CredentialCache theNetCache = new CredentialCache();
theNetCache.Add(new Uri(@"rdp://RemoteMachine:3389"), "Basic", theNetworkCredential);

and while it doesn't error out, it doesn't show up in the Credential Manager.

Any idea what I'm doing wrong or not doing at all?

Iunknown
  • 347
  • 1
  • 2
  • 16
  • `TERMSRV/RemoteMachine` not `TERMSRV//RemoteMachine` – Charlieface Jun 03 '23 at 23:39
  • Thanks @Charlieface...but that still results with 'System.UriFormatException: 'Invalid URI: The format of the URI could not be determined.'' Here's the actual line I'm using, maybe there's some other syntax problem that I'm missing. theNetCache.Add(new Uri("TERMSRV/geneprod"), "Digest", theNetworkCredential); – Iunknown Jun 04 '23 at 02:24

0 Answers0