_ap_ufes{"success":true,"siteUrl":"www.jucktion.com/tech","urls":{"Home":"https://www.jucktion.com/tech","Category":"https://www.jucktion.com/tech/c/mobile/android/","Archive":"https://www.jucktion.com/tech/2017/11/","Post":"https://www.jucktion.com/tech/pushbullet-notifications-automated-browser-testing/","Page":"https://www.jucktion.com/tech/about/","Attachment":"https://www.jucktion.com/tech/pushbullet-notifications-automated-browser-testing/pushbullet-web-test-complete-notification/","Nav_menu_item":"https://www.jucktion.com/tech/3985/"}}_ap_ufee Solution to Autohotkey automation failing to work with disconnected Remote Desktop - Tech Junction

Solution to Autohotkey automation failing to work with disconnected Remote Desktop

By | 15th August, 2017 | 0 Comments

Windows automation tool like Autohotkey, AutoIt or other Application testing suite fail to load when using them on the remote desktop. The problem occurs as the Remote Desktop is disconnected, the interface automation tools fail to detect changes and stop working.

There have been some workarounds for this problem. One being a registry hack to add an RemoteDesktop_SuppressWhenMinimized entry to enable automation tools to detect window changes.  While this seems to work, you still need the connection to be active on the minimized remote desktop connection manager.

1. Locate any of the following Registry keys:

  • HKEY_CURRENT_USER/Software/Microsoft/Terminal Server Client(if you want to change the RDC settings for your user account)

2. Create a new DWORD value in this key named RemoteDesktop_SuppressWhenMinimized. Specify 2 as the value data.

Another one is to disconnect the Remote Desktop using tscon.exe as such it doesn’t lock the user account and allows the Window detection in Windows operating system.  This requires you to create a batch file and run it every time before you disconnect your connection. While this may be the simplest way, you might not always be remember to run it. And as you disconnect through regular remote desktop, your tests would have failed or paused until you log back in.

Create a batch file with the following commands and save it to the desktop of the workstation you want to keep unlocked:

START C:\Windows\System32\tscon.exe 0 /dest:console
START C:\Windows\System32\tscon.exe 1 /dest:console
START C:\Windows\System32\tscon.exe 2 /dest:console
START C:\Windows\System32\tscon.exe 2 /dest:console
START C:\Windows\System32\tscon.exe 3 /dest:console
START C:\Windows\System32\tscon.exe 4 /dest:console
START C:\Windows\System32\tscon.exe 5 /dest:console

For AutoHotKey:

Run % "*RunAs C:\Windows\System32\tscon.exe " (A_Index-1) " /dest:console",,HIDE

There’s an alternative I’ve found that works similar to second option we listed above. This is accomplished by applications that connect to the Remote desktop with their own protocols. I have tested it with the Jump Desktop Remote Desktop manager. But this should work on other applications like Teamviewer and Splashtop. As they use their own connection to connect and do not lock the device while you disconnect, the automation tests can run un-interrupted.

Let me know if this works for you.

Tags: , , ,

Category: How To's