Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.Windows.Forms.SendKeys.Send("^+{ENTER}");
- https://msdn.microsoft.com/en-us/library/aa382952(VS.85).aspx
- https://social.msdn.microsoft.com/Forums/vstudio/en-US/76fff61c-a224-40bc-a108-2d3f2f616cd7/microsoft-terminal-services-library-programmatically-execute-a-batch-file-program-on-a-remote?forum=csharpgeneral
- https://social.technet.microsoft.com/Forums/windowsserver/en-US/2a6c79cc-3890-4899-850c-a938320a4b6e/remoteapp-and-mstsclib?forum=winserverTS
- https://social.technet.microsoft.com/Forums/windowsserver/en-US/1b3f1f70-9eea-45d8-a6c4-5c5a71e6fa1a/launch-ts-remote-app-from-terminal-services-api?forum=winserverTS
- ...
- this.rdp = new AxMSTSCLib.AxMsRdpClient9NotSafeForScripting();
- ...
- this.rdp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("rdp.OcxState")));
- ...
- private AxMSTSCLib.AxMsRdpClient9NotSafeForScripting rdp;
- ...
- ...
- rdp.Name = "RDP";
- rdp.Enabled = true;
- rdp.AdvancedSettings.allowBackgroundInput = 1;
- rdp.AdvancedSettings2.DisplayConnectionBar = true;
- rdp.AdvancedSettings2.SmartSizing = true;
- rdp.AdvancedSettings2.RDPPort = 3389;
- rdp.TransportSettings.GatewayUsageMethod = 2;
- rdp.TransportSettings.GatewayCredsSource = 0;
- rdp.TransportSettings.GatewayProfileUsageMethod = 1;
- rdp.TransportSettings.GatewayHostname = gateway;
- rdp.TransportSettings2.GatewayUsername = username;
- rdp.TransportSettings2.GatewayPassword = password;
- rdp.DesktopHeight = 768;
- rdp.DesktopWidth = 1366;
- rdp.Server = server;
- rdp.UserName = username;
- MSTSCLib.IMsTscNonScriptable secured = (MSTSCLib.IMsTscNonScriptable)rdp.GetOcx();
- secured.ClearTextPassword = password;
- rdp.ConnectingText = "Connecting...";
- rdp.DisconnectedText = "Disconnected";
- var ocx = (MSTSCLib.IMsRdpClientNonScriptable5)rdp.GetOcx();
- ocx.EnableCredSspSupport = true;
- ocx.AllowCredentialSaving = false;
- ocx.PromptForCredentials = false;
- ocx.PromptForCredsOnClient = false;
- ocx.WarnAboutSendingCredentials = false;
- ocx.AllowPromptingForCredentials = false;
- ocx.MarkRdpSettingsSecure = true;
- //rdp.AdvancedSettings7.DisableRdpdr = 0;
- //rdp.CreateVirtualChannels("CH001,CH002");
- var settings = (MSTSCLib.IMsRdpClientAdvancedSettings8)rdp.AdvancedSettings;
- settings.allowBackgroundInput = 1;
- settings.ClientProtocolSpec = MSTSCLib.ClientSpec.FullMode;
- settings.ConnectToServerConsole = true;
- settings.EnableCredSspSupport = true;
- settings.EncryptionEnabled = 1;
- rdp.Connect();
- ...
Add Comment
Please, Sign In to add comment