使用axmstsclib连接到Win10,使用RDP连接到C#

时间:2016-08-18 18:40:23

标签: c# rdp

所以我有一个小的C#应用​​程序,它有一个host and a password,并希望连接到该主机,该主机是开箱即用的Windows 10.问题是我得到一个对话框说

  

主机需要密码。

以前连接到Windows 7的盒子没有问题,因为安全性是自动协商的。现在使用以下代码AxMsRdpClient9,我似乎无法连接。我试图找出我需要应用哪些设置组合来使用预定密码到RDP到Windows 10盒子而无需用户交互。谢谢!

rdpViewer.AdvancedSettings2.RDPPort = port;
rdpViewer.AdvancedSettings8.ClearTextPassword = password;
rdpViewer.AdvancedSettings3.ConnectToServerConsole = true;
rdpViewer.AdvancedSettings8.ConnectToAdministerServer = true;
rdpViewer.AdvancedSettings8.EnableAutoReconnect = true;
rdpViewer.AdvancedSettings8.RedirectDrives = true;
rdpViewer.AdvancedSettings8.GrabFocusOnConnect = true;
rdpViewer.AdvancedSettings8.DisplayConnectionBar = true;
rdpViewer.AdvancedSettings8.EnableWindowsKey = 1;
rdpViewer.AdvancedSettings8.DisableCtrlAltDel = 1;
rdpViewer.AdvancedSettings8.allowBackgroundInput = 1;
rdpViewer.AdvancedSettings8.AcceleratorPassthrough = 1;
rdpViewer.AdvancedSettings8.BitmapPeristence = 1;
rdpViewer.AdvancedSettings8.Compress = 1;
rdpViewer.AdvancedSettings8.DoubleClickDetect = 1;                
rdpViewer.AdvancedSettings2.PerformanceFlags |= 0x00000080; //TS_PERF_ENABLE_FONT_SMOOTHING;
rdpViewer.Connect();

1 个答案:

答案 0 :(得分:2)

尝试将EnableCredSspSupport设置为true。像这样:

  axMsRdpClient6NotSafeForScripting1.AdvancedSettings7.EnableCredSspSupport = true;