So, Doing some exploring, I was able to remotely launch applications on the remote server on my own personal Winsta. From there I wanted to see if I could automate mouse and keystrokes.
The full window (include children windows) seems to act as one class “Rail_Window” and doesn’t uncover the underlying Control’s / Forms. So I stayed safe and decided to use just keystrokes but FOCUS command in AutoIt is not working with this window class, so I deiced to use a Minimize / restore combo to bring it to the forefront of my desktop then send it keys like below. This may open another possibility to automate server workflow processes without the need for additional software installation. Heck even adding Bitblt I could even capture images and use them to target mouse clicks on the remote machine if I really need it.

http://controllingtheinter.net/2018/05/25/creating-a-citrix-like-session-with-powershell-and-rdp/
http://controllingtheinter.net/2018/05/24/creating-a-virtualized-application-on-a-remote-server-local-on-your-desktop/

Opt("WinDetectHiddenText", 1)   ;0=dont detect, 1=do detect
$hWnd = WinGetHandle("Calculator (Remote)")

If @error Then
    $cmd = WinGetHandle("Administrator: C:\Windows\System32\cmd.exe (Remote)")
    WinSetState($cmd, "", @SW_MINIMIZE )
    WinSetState($cmd, "", @SW_RESTORE )
    ControlSend ( $cmd, "", "", "^c")
    ControlSend ( $cmd, "", "", "calc{enter}")
    Sleep(1000)
EndIf

WinActive("Calculator (Remote)")
$hWnd = WinGetHandle("Calculator (Remote)")
WinSetState($hWnd, "", @SW_MINIMIZE )
WinSetState($hWnd, "", @SW_RESTORE )
ControlSend ( $hWnd, "", "", "587")
Sleep(1000)
ControlSend ( $hWnd, "", "", "!vp")
Sleep(1000)
ControlSend ( $hWnd, "", "", "!vt")
Sleep(1000)

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax