A short Wi-Fi drop or a mobile hotspot switching towers can close your Remote Desktop window, even though the server and your apps are still running. Remote Desktop can reconnect on its own and put you back into the same session. This guide shows the client setting, the matching .rdp lines, a server keep-alive policy and simple checks to find out whether your network needs fixing.
Before you start
- A Remote Desktop client: Remote Desktop Connection (
mstsc) on Windows, or Windows App on Mac, iPhone, iPad or Android. - Administrator access on the server for the keep-alive policy. Windows VPS and Admin RDP both include it.
- Your connection address in the form
203.0.113.10:3389. servers use TCP port 3389 for Remote Desktop.
Note: Disconnecting does not close your programs. When you reconnect with the same user, you return to the same session with apps still open, unless a session time limit signs you out.
Turn on reconnect in Remote Desktop Connection
- Press Win + R, type
mstscand press Enter. - Enter
203.0.113.10:3389and click Show Options. - Open the Experience tab.
- Tick Reconnect if the connection is dropped.
- Go back to General and click Save (or Save As) so the setting is kept in your
.rdpfile.
When the link drops, the session window stays open with a banner while the client tries again. It keeps trying for a limited number of attempts before giving up.
Set it in an.rdp file
If you share connection files or use a saved shortcut, check these lines in Notepad:
full address:s:203.0.113.10:3389
autoreconnection enabled:i:1
autoreconnect max retries:i:20autoreconnection enabled:i:1turns automatic reconnection on.autoreconnect max retriessets how many times the client tries before it stops. A higher number helps on unreliable links.
The full list of lines is in Create and edit.rdp files: the settings that matter.
Windows App on Mac and mobile
Windows App reconnects automatically for most short drops and has no separate switch for it in most versions. If sessions close on every blip, update the app first, then check your network with the steps below.
Add a keep-alive on the server
Some routers and mobile networks close idle connections after a few minutes. A keep-alive makes the server send small packets so the connection stays visibly active, and it helps the server notice dead connections and mark the session as disconnected cleanly.
On the server, sign in as an administrator:
- Press Win + R, type
gpedit.mscand press Enter. - Go to Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Connections.
- Open Configure keep-alive connection interval, choose Enabled and set the interval in minutes, for example
1. - In the same folder, check that Automatic reconnection is not set to Disabled. Not Configured or Enabled both allow reconnection.
- Click OK, then apply the policy:
gpupdate /forceTip: Existing sessions pick up the change after you sign out and back in.
Check your network stability
Auto-reconnect hides short drops but does not fix a bad line. Test from your own PC.
Run a continuous ping to the server for a few minutes while you work:
ping -t 203.0.113.10Press Ctrl + C to stop. Look at the summary:
- 0% loss and steady times: the network is fine; look at server-side causes.
- Regular "Request timed out" lines: packets are being lost between you and the server.
- Times that jump from low to several hundred ms: congestion, often from Wi-Fi or other devices using the line.
Also confirm the RDP port answers:
Test-NetConnection 203.0.113.10 -Port 3389If you see drops, try a wired connection or a different network to compare. Some servers may not answer ping if ICMP is blocked in Windows Firewall; in that case rely on the port test.
Check it works
- Connect to your server and open a program, such as Notepad with some text.
- Turn off Wi-Fi on your PC for 10–20 seconds, then turn it back on.
- The session window should show a reconnecting banner, then return to the same desktop with Notepad still open.
On the server, you can confirm the session stayed alive:
quserYour user should be listed with a state of Active.
Troubleshooting
- Window closes instead of reconnecting: the setting was not saved in the file you open. Edit the shortcut's
.rdpfile and confirmautoreconnection enabled:i:1. - Reconnects, but to a new empty desktop: you signed in with a different user, or a policy ended the old session. Check Stop Remote Desktop sessions ending when idle or disconnected.
- Drops every few minutes exactly: a router or firewall closes idle connections. Set the keep-alive interval as shown above.
- Constant drops even on a good network: see Fix Remote Desktop that keeps disconnecting for deeper checks, including UDP issues.
Next steps
- Keep programs running after you disconnect: Keep apps running 24/7 on your RDP server.
