ProMacTools

How to Keep a Remote Desktop or Windows App Session From Disconnecting on Mac

Updated · by the ProMacTools team

Why sessions disconnect

Windows servers and Azure Virtual Desktop apply session limits such as "disconnect after N minutes of inactivity" and the screen lock timeout. They measure input received inside the remote session.

caffeinate or Amphetamine keep the Mac from sleeping, which prevents the connection from dropping because your Mac slept — but the remote computer still sees no input.

Fix 1: change the policy (if you control the server)

Adjust the Remote Desktop Services session time limits in Group Policy or the host pool settings, and the screen saver / lock timeout inside the remote Windows session.

Fix 2: send input from your Mac with AutoKey

  1. Open AutoKey and choose Windows App (or Microsoft Remote Desktop) as the target app.
  2. Pick Shift or F15 and an interval shorter than the timeout, for example every 4 minutes.
  3. Keep "wait until I stop typing" on, and click Start.

AutoKey brings the remote window forward for a moment, presses the key and returns you to what you were doing.

Check your organisation's rules

Idle timeouts are often a security requirement. If the remote machine belongs to your employer, make sure keeping sessions alive is allowed.

Frequently asked questions

Does caffeinate keep a Remote Desktop session alive?

No. caffeinate prevents your Mac from sleeping, but the remote Windows session measures input inside the session. It needs a key press or mouse movement sent to the remote window.

What key should I send to keep a remote session active?

A key with no visible effect, such as Shift or F15, every few minutes — shorter than the remote idle timeout.

Can AutoKey send keys to Windows App while I use another app?

Yes. Set Windows App as the target. AutoKey switches to it briefly and returns, or sends the key in the background if Windows App accepts that.