自动化远程桌面连接
我们使用许多远程桌面在我们的开发环境,有部署在多个环境中多台服务器。这是乏味记住他们的IP地址,用户名和密码。我想写一个小工具,上面有按钮。点击后,我要开始的远程桌面,自动从一些列表获取用户名和密码。
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.
我知道有一个命令行相当于MS远程桌面: MSTSC
。
This线程建议要做到这一点,如下所示:
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"
我跑第一线,它说,成功添加凭据。后来,当我跑第二行它只是运行指定IP远程桌面连接,并询问用户名和密码。我想它通过自动应用在 cmdkey
指定的凭证在指定的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
.
- 这里有什么不对吗?是否有可能使用这样的PowerShell脚本?
- 我可以调用通过HTML页面这个脚本(因为是我将铺设到的网页,这将作为我们开发商一个地方链接其他很多资源,所以我们不会浪费时间和精力找到他们我们希望他们各一次。是否有可能通过注册申请到URI方案?)
- 是否有任何其他的(标准)的方式?
在你尝试的问题是参数 /通用
。
the problem in your attempt is the parameter /generic
.
按照官方网站cmdkey , /通用
标识该条目将与相关的计算机名或域名。
identifies the computer or domain name that this entry will be associated with.
在我的例子,我会打电话给计算机 COMPUTER01 的
In my example, I will call the computer Computer01.
你想用TERMSRV / COMPUTER01相关的凭据? (如您的例子 /通用:TERMSRV /计算机名或IP
表示)
Do you want the credentials associated with TERMSRV/Computer01 ? (Like your example /generic:TERMSRV/"computername or IP"
said)
没有,你想让它关联到正常的计算机名 COMPUTER01 的
No, you want it associated to the normal computername Computer01.
然后,你必须删除 TERMSRV /
。
工作的结果是:
cmdkey /generic:"computername or IP" /user:"username" /pass:"password"
要你的其他问题:
- 参见上面的答案
- 我不知道它可能只用HTML。我不认为如此。但我也实施一些PowerShell脚本到ASP.NET。这工作。
- 请参见上面的回答