We use many remote desktops in our development environment and there are many servers deployed in multiple environments. It is tedious to remember their IPs, 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.
I know there is a command line equivalent for MS Remote Desktop: mstsc
.
This thread suggests to do this as follows:
cmdkey /generic:TERMSRV/"computername or IP" /user:"username" /pass:"password"
mstsc /v:"computer name or IP"
I run first line and it says credential successfully added. Then when I run second line it simply runs Remote Desktop Connection for the specified IP and asks for username and password. I would like it to simply open the remotely connected desktop at specified IP by automatically applying the credential specified in cmdkey
.
- What's wrong here? Is it possible using such Powershell script?
- Can I invoke this script through HTML page (since there are many other resources that I will be laying onto the webpage which will serve as a 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 registering application to URI scheme ?)
- Is there any other (standard) way?
the problem in your attempt is the parameter /generic
.
According to the official website for cmdkey, /generic
identifies the computer or domain name that this entry will be associated with.
In my example, I will call the computer Computer01.
Do you want the credentials associated with TERMSRV/Computer01 ? (Like your example /generic:TERMSRV/"computername or IP"
said)
No, you want it associated to the normal computername Computer01.
Then you have to remove TERMSRV/
.
The working result is:
cmdkey /generic:"computername or IP" /user:"username" /pass:"password"
To your other questions:
- See the answer above
- I don't know if its possible with HTML only. I don't think so. But I also implement some PowerShell scripts into ASP.NET. This works.
- See answer above
This is very old question. A lot had changed since. Many ops already suggested to use ready made tools which does this. Back in year 2013, Windows store wasnt that great place (*my opinion). But now its ok. There is Microsft's own Remote Desktop app in the store. The app is universal, that is it run on pc, mobile and holographics.
Whats good? Microsoft has made same app available on Android. I have tried for PC and Android. Both work great.
So have a try. I am regular user of these apps now.
来源:https://stackoverflow.com/questions/16479652/automating-remote-desktop-connection