1

我正在尝试通过 RDP 连接并使用从 PROPERTIES 文件中获取的凭据对特定服务器进行身份验证自动化一些身份验证。

在 Windows 上,内置的 RDP 客户端是 mstsc.exe,但您似乎无法像在 linux 和 Mac 上那样通过命令行提供登录凭据。

在 Windows 上是否有任何解决方法,使用 mstsc.exe,我可以在其中自动进行身份验证,而无需用户进行任何交互?

谢谢。

4

2 回答 2

2

You can store the RDP credentials using the cmdkey tool

    cmdkey.exe /generic:servername /user:username /pass:pass

Once you have run this, your mstsc call will be able to auto login:

    mstsc.exe /v:servername
于 2017-08-29T14:41:42.780 回答
1

您可以使用自定义连接文件吗?然后将其传递给 MSTSC EG:

mstsc customfile.RDP

这是 RDP 文件的样子,我保存了凭据,注意 FULL ADDRESS 字段和 USERNAME 字段。

 screen mode id:i:2
use multimon:i:0
desktopwidth:i:1680
desktopheight:i:1050
session bpp:i:32
winposstr:s:0,3,0,0,800,600
compression:i:1
keyboardhook:i:2
audiocapturemode:i:0
videoplaybackmode:i:1
connection type:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
allow font smoothing:i:0
allow desktop composition:i:0
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:###.###.###.###:####
audiomode:i:0
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
redirectdirectx:i:1
autoreconnection enabled:i:1
authentication level:i:2
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
use redirection server name:i:0
username:s:<USERNAME>

将其传递给 mstsc.exe 调用。我会尝试查看密码的存储位置。

I wouldn't call this super secure either. I think the password is stored encrypted, it'll be a few minutes until I figure out how.

What are you trying to accomplish exactly? MSTSC doesn't return values based on authentication. So, I'm not sure what you plan on capturing.

于 2012-04-03T20:09:09.263 回答