Using PTFB in conjunction with Remote Desktop

Lately I’ve dealt with a number of support requests involving the use of PTFB on servers, where the user typically connects to the server via remote desktop. While the remote desktop window is open and on-screen, everything works fine; if the remote desktop window is minimized or closed, PTFB seemingly stops dealing with target windows automatically.

In reality, what’s happening here is that when the remote desktop window is minimize or closed, the remote Windows machine becomes unresponsive to all PTFB’s attempts to press buttons and keys. PTFB still tries to carry out its appointed tasks, but  its efforts are ignored by the remote OS. Happily, there are ways round this.

On XP or a more recent OS with UAC Disabled

If against all security advice you’re still using Windows XP(!), OR you’re running a more recent OS with User Account Control (UAC) disabled, there’s a setting in PTFB that should help:

1) Click the Options button and choose “Configure…” from the popup menu
2) On the Settings tab (first tab of the Configure screen) look for the section labelled “Locked Workstation / Remote Desktop”
3) Within that section, tick the option marked “Disconnect Remote Desktop Session to press targets” and close the config screen

When this option is set and PTFB Pro is about to take action via a single press or macro, PTFB checks to see if a remote desktop session is open but inactive (i.e. RDP is blocking simulated actions because the window is closed or minimized). If the session is inactive, it uses the tscon command to formally disconnect the session, removing the blockage. The beauty of this setting is that no action will be taken unless it’s really necessary, i.e. the session will not be disconnected unless it has entered the inactive state and a target must be handled.

More recent Windows OS with UAC enabled, when minimizing a remote session

If you typically minimize your remote desktop session windows rather than closing them, there’s little registry edit that will eliminate the problem. Warning: take great care when editing the registry, otherwise you could leave your operating system in an unusable state.

On your local computer, close all open Remote Desktop sessions.

  1. Launch the Registry editor (regedit.exe).
  2. Navigate to the following Registry key:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
  3. Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.
  4. Close the Registry Editor.

The above edit should kick in when you next minimize an RDP session window, and allow PTFB to keep doing its thing.

Other cases

So let’s say you’re running a recent OS like Windows 7/8/10 or Svr 2008 or later, you have UAC enabled, and you typically close your remote session windows when you’re done with them. In this case, you need to use the TSCON command kick the remote machine back to an interactive state so that PTFB can operate. PTFB cannot do this for you, because the TSCON command requires admin privileges and by default PTFB does not run in an elevated / privileged state.

As a workaround, you can create a small .bat file on the remote PC that includes the following command line:

tscon 1 /dest:console

Now create a shortcut to the .bat file and in the Compatibility page of the shortcut’s properties set the option labelled “Run this program as an administrator”. Remember to use the shortcut to exit the remote session from within the remote desktop window whenever you want PTFB Pro to be able to continue handling targets; do this instead of closing the window as normal. Note however that Windows will ask you for permission for this each time your little .bat file runs.