DEV Community

Auten
Auten

Posted on

Your agent's clicks stop when you minimize Remote Desktop or lock the screen

Your agent runs fine on a Windows box you reach over Remote Desktop. You start a long task, minimize the RDP window to do something else, and come back to a run that failed halfway: clicks returned "ok", keystrokes went nowhere, screenshots are black or stale. Or you closed the RDP window at the end of the day and every overnight run failed at its first click.

Nothing is wrong with the model or your MCP server. GUI automation needs a desktop that Windows is actually drawing, and both of those actions take it away.

What happens in each case

  • You minimize the RDP window. By default the Remote Desktop client tells the remote session it is not visible, and Windows switches that session to a GUI-less mode. Windows and controls are not drawn, so there is nothing to click and nothing to screenshot.
  • You disconnect or close RDP. The remote session is locked and Windows shows the logon screen. On a locked desktop the OS stops drawing the user's GUI.
  • The screen locks by itself (idle timeout, Win+L). Same as above: the input lands on the lock screen, not on your app.

In all three cases synthetic input does not raise an error. SendInput style calls simply have no live desktop to deliver to, which is why the tool reports success while nothing moves.

Fix 1: keep the session drawn when the RDP window is minimized

This is a setting on the computer you connect from, not on the remote one.

  1. Close all Remote Desktop sessions on your local computer.
  2. In regedit, open HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client (or the same path under HKEY_LOCAL_MACHINE for all users).
  3. Create a DWORD named RemoteDesktop_SuppressWhenMinimized with value 2.
  4. On 64-bit Windows you may need the same value under ...\Software\Wow6432Node\Microsoft\Terminal Server Client as well.

Or in one line from a normal PowerShell:

New-ItemProperty -Path "HKCU:\Software\Microsoft\Terminal Server Client" `
  -Name RemoteDesktop_SuppressWhenMinimized -PropertyType DWord -Value 2 -Force
Enter fullscreen mode Exit fullscreen mode

Reconnect, and minimizing no longer takes the remote GUI away. SmartBear notes one known side effect: it can break screen sharing in Microsoft Lync.

Fix 2: leave RDP without locking the remote machine

Closing the RDP window locks the session. Instead, hand the session back to the remote computer's console. Run this on the remote computer, inside the RDP session, as Administrator:

for /f "skip=1 tokens=3" %s in ('query user %USERNAME%') do %windir%\System32\tscon.exe %s /dest:console
Enter fullscreen mode Exit fullscreen mode

(In a .bat file, double the percent signs: %%s.) Your RDP client closes with "Your Remote Desktop Services session has ended", and the desktop stays unlocked and drawn on the remote machine, so the agent keeps working.

Two things to know:

  • It leaves the machine unlocked. Anyone with physical access to that screen can use it. Lock it when the run is done (Rundll32.exe user32.dll,LockWorkStation), never while a GUI run is still going.
  • The console resolution applies after the switch, which may differ from your RDP window size. If your agent relies on coordinates rather than UI elements, check the first screenshot after reconnecting.

Fix 3: use a remote tool that does not tear down the desktop

A VNC server shows the machine's real console instead of a separate virtual session. Minimizing or disconnecting a VNC client does not destroy the active desktop by default, and the same approach works on macOS (Screen Sharing is VNC) and Linux. The pywinauto remote execution guide recommends this as the simpler route. Mixing RDP and VNC on the same box brings the RDP problems back, so pick one.

What none of these fix

A locked screen. If the machine locks, from an idle timeout or a policy, the input goes to the secure logon desktop, which no ordinary process can drive. That is by design. For unattended runs, set the idle lock and sleep timeouts on that machine so they do not fire mid-run, if your security policy allows it, and run on a box nobody else can walk up to.

A short pre-flight before a long or overnight run

  • Remote over RDP -> RemoteDesktop_SuppressWhenMinimized = 2 on your local computer.
  • Leaving for the night -> tscon ... /dest:console, not the X button.
  • Idle lock or sleep would fire before the run ends -> fix that first.
  • Screenshots black or frozen, clicks "ok" but ignored -> check whether the session is minimized, disconnected or locked before you blame the model.

Why we care

We build Auten, an MCP server that gives Claude Code, Codex, Cursor or any MCP client hands on a real screen: your computer (Mac, Windows, Linux) and your Android phone (beta). It runs on the machine whose screen it controls, so it needs a live, unlocked desktop exactly like every other tool here. Setup is at auten.ai/mcp.

If you run agents on remote Windows machines and hit a case these three fixes did not cover, describe it in the comments. We collect these.

Top comments (0)