title: Automating remote desktop connection
body: <p>We use many remote desktops in our development environment and there are many servers deployed in multiple environments. It is tedious to remember their IP addresses, usernames, and passwords. I want to write a small utility with buttons on it. When clicked, I want to start those remote desktops, automatically fetching usernames and passwords from some list.</p>
  
  <p>I know there is a command line equivalent for MS Remote Desktop: <code>mstsc</code>. 
  <a href="https://stackoverflow.com/questions/11296819/run-mstsc-exe-with-specified-username-and-password">This</a> question suggests to do this as follows:</p>
  
  <pre><code>cmdkey /generic:TERMSRV/"computername or IP address" /user:"username" /pass:"password"
  mstsc /v:"computer name or IP"
  </code></pre>
  
  <p>I run the first line, and it says credential successfully added. Then when I run the second line it simply runs Remote Desktop Connection for the specified IP address and asks for username and password. I would like it to simply open the remotely connected desktop at specified IP address by automatically applying the credential specified in <code>cmdkey</code>. </p>
  
  <ul>
  <li>What's wrong here? Is it possible using such PowerShell script? </li>
  <li>Can I invoke this script through an HTML page (since there are many other resources that I will be laying onto the webpage which will serve as one spot links for we developers, so that we will not be wasting time and effort finding them each time we want them)? Is it possible by <a href="https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85)" rel="nofollow noreferrer">registering the application to a URI scheme</a>?</li>
  <li>Is there another (standard) way?</li>
  </ul>