How to automatically bypass logon message on RDP?

c#, remote-desktop

Solution

Well, there is a way to do what you ask. You will need to download a copy of Windows 7 Embedded Standard (WES7 wSP1). WES7 contains something that other editions of Windows 7 do not - a Dialog Filter. It runs as a service, and allows you to specify certain window events to be performed automatically, without user interaction.

The Dialog Filter Editor is installed with the Windows Embedded Standard 7 tools in the EmbeddedSDK\bin folder.

All you have to do is:

Add the service to your Windows, by copying the necessary Dialog Filter files to C:\Windows\System32. There are x86 and x64 versions, so choose the correct architecture.

Register the files, and enable the service to run automatically.

Add the ConfigurationList.xml file created with the editor to C:\ProgramData\Microsoft\DialogFilter. This location is hidden by defeault, so make sure to show hidden files and unhide protected system files in Windows Explorer.

I've actually created the ConfigurationList.xml file already, so you can simply copy the following code and save it as "ConfigurationList.xml":

<?xml version="1.0" encoding="utf-8"?> 
<CL:dialogs xmlns:CL="urn:Dialogs"> 
    <dialog> 
    <ProcessImageName>rundll32.exe</ProcessImageName> 
    <Title>Remote Desktop Connection</Title> 
    <Class>#32770</Class> 
    <Buttons> 
      <Button>OK</Button> 
      <Button>Cancel</Button> 
      <Button>Close</Button> 
    </Buttons> 
    <Actions> 
      <Action>OK</Action> 
    </Actions> 
  </dialog> 
</CL:dialogs>

As you can see, the action is set to press the OK button automatically in the RDP dialog that pops up when making an RDP connection.

More info regarding the Dialog Filter directly from MS: https://msdn.microsoft.com/en-US/library/ff794135(v=winembedded.60).aspx

Problem

I'm trying to log in to a server through remote desktop using c#. I'm able to initiate the connection using the `AxMSTSCLib` and the code below. However, I'm stuck on our domain's security notice. When logging in manually it requires you to click ok on the notice before the log in completes. I have been unable to find anyway to interact with this OK button through my application. I've tried variations of `SendKeys`, sending key events using interop services, finding the cursor position and sending a mouse click event... I'm running out of ideas here. ``` rdp.Server = server; rdp.Domain = domain; rdp.UserName = userName; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = password; rdp.StartConnected = 1; rdp.Connect(); ``` Thanks

Original source