Keep Programs Running After Closing RDP: Safe Steps

Learn how to keep program running after closing RDP: disconnect without signing out, check session limits, restart MT4/MT5 safely, and verify it works.
A glowing remote desktop window remains connected to a forex chart on a dark server background.

To keep program running after closing RDP, disconnect the Remote Desktop client instead of signing out of Windows. The session stays on the VPS, so MT4, MT5, bots, and other open applications can continue running while you close your laptop or phone.

Disconnect vs sign out

These two actions look similar but have different results. Disconnecting closes your view of the remote desktop; signing out ends your Windows user session and closes the programs running inside it.

ActionWhat happens to your Windows sessionWhat happens to open programs
Close the RDP windowThe session changes to DisconnectedUsually continues running on the VPS
Choose DisconnectThe session remains open but no RDP client is attachedUsually continues running
Choose Sign out or Log offThe session endsPrograms close
Choose Restart or Shut downWindows restarts or powers offPrograms close; they need a restart plan

Microsoft describes a disconnected RDS session as one where the connection is gone but the session continues running on the server. That is the behavior you want for a terminal, long-running script, or monitoring application. See Microsoft’s explanation of RDS session states for the distinction between active, locked, and disconnected sessions.

What you need

Before you change anything, make sure you have:

  • Administrator access to the Windows VPS, or permission from the server administrator.
  • The same Windows username and password you use to reconnect.
  • The application already installed and working while you are connected.
  • A simple way to confirm activity, such as an MT4/MT5 journal entry, a bot log, or a test file timestamp.

If your goal is to run MT4 or MT5 continuously, enable the terminal’s trading or automation feature first and use a demo account for the initial test. Closing RDP does not fix an EA that is disabled, logged out of the broker, or missing from the terminal.

Step 1: Disconnect RDP without signing out

Why: Closing the client leaves the Windows session on the VPS, while signing out destroys the session that owns your open programs.

  1. Open the application you want to keep running. For MT4 or MT5, confirm that the terminal is connected and the EA or automated strategy is enabled.
  2. Save any configuration or files you have changed.
  3. Close the Remote Desktop window with the X in the connection window or the full-screen connection bar.
  4. If Windows displays a message saying the remote session will be disconnected and programs will continue to run, confirm it.

Do not use Start > Sign out, Log off, or Start > Power > Shut down. On a phone or tablet, end the RDP connection from the client rather than choosing a sign-out option inside the remote Windows desktop.

Success: You return to your local device, and the VPS remains powered on with the Windows session disconnected.

Step 2: Check that the session is disconnected

Why: This confirms that you closed the connection rather than ending the Windows session.

Reconnect to the VPS after a few minutes using the same username. Your open windows should be where you left them. For MT4 or MT5, check the chart, terminal connection status, and Experts or Journal tab.

You can also check the session state from an elevated Command Prompt:

query user

While you are connected, your user normally appears as Active. Immediately after closing RDP, the same session should appear as Disc or Disconnected. When you connect again, it should return to Active instead of creating a fresh desktop with none of your programs open.

If the application is open but its data is not changing, inspect its own log. A disconnected Windows session is not the same as an application connected to its broker, API, or data source.

Step 3: Check session time-limit settings

Why: A policy can later sign out or end a disconnected session even if closing RDP worked at first.

On a personal Windows VPS where you have administrator access, check the local Group Policy settings:

  1. Press Win + R, type gpedit.msc, and press Enter.
  2. Open Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits.
  3. Open Set time limit for disconnected sessions. Set it to Disabled or Not configured unless you intentionally want automatic logoff.
  4. Check Set time limit for active but idle Remote Desktop Services sessions. Set it to Not configured or Never for a workload that must keep running.
  5. Check Set time limit for active Remote Desktop Services sessions and use Not configured or Never unless a deliberate maximum session length is required.
  6. Check End session when time limits are reached. It should not be enabled if you need the session to remain available.
  7. Open an elevated Command Prompt and run:
gpupdate /force
  1. Disconnect and reconnect once so the policy is applied to your session.

Microsoft documents these policies under the Remote Desktop Session Host Session Time Limits path. The defaults can be changed by computer or user policy, and computer policy takes precedence over user policy. On a company-managed server, a domain administrator may control these values, so a local change may not be enough.

Success: A test session stays disconnected for the length of time you need, and reconnecting returns you to the same Windows desktop instead of a signed-out session.

Step 4: Make apps start after a reboot

Why: Disconnecting RDP does not restart Windows, but updates, maintenance, or an intentional reboot will close every running program. A restart-safe setup protects you from assuming that a disconnected session survived a reboot.

For a normal desktop application such as MT4 or MT5, the simplest method is the Startup folder:

  1. Press Win + R.
  2. Enter shell:startup and press Enter.
  3. Copy the application’s shortcut into the folder.
  4. Restart the VPS during a safe test window.
  5. Sign in to the same Windows account and confirm that the application opens.

For more control, use Task Scheduler:

  1. Press Win + R, enter taskschd.msc, and press Enter.
  2. Select Create Task and give it a clear name, such as Start MT5.
  3. On Triggers, add At log on for the Windows account that owns the terminal.
  4. On Actions, choose Start a program, browse to the application executable, and set its Start in folder if the program needs one.
  5. On General, use Run only when user is logged on for a desktop application that needs an interactive Windows session. Enable Run with highest privileges only when the application requires it.
  6. On Settings, allow the task to restart if it fails, then save it.
  7. Right-click the task and choose Run to test it before rebooting.

The Startup folder and an At log on task run when that Windows account signs in. If the VPS does not automatically sign in after a reboot, you must sign in once before a GUI application can start. Avoid selecting Run whether user is logged on or not for MT4, MT5, or another app that needs a visible desktop until you have tested it; it can run in a non-interactive session. Microsoft provides a Task Scheduler overview for advanced triggers.

If you are configuring a new server, see our Windows VPS setup checklist before you run the restart test.

Success: After a controlled reboot and sign-in, the application opens, reconnects to its service, and begins producing a fresh log entry.

Step 5: Test it safely

Why: A five-minute disconnect test shows that the session survives; a separate reboot test shows whether your recovery setup works.

Use this sequence:

  1. Start the program and record its current status, chart time, or log timestamp.
  2. Disconnect RDP with the window’s X. Do not sign out.
  3. Wait 10 to 15 minutes. A longer wait is useful if you suspect an idle-session policy.
  4. Reconnect with the same account.
  5. Confirm that the program is still open and that its own log or status has advanced.
  6. If the application is a trading terminal, confirm the account connection and automation state on a demo account.
  7. Only after that test succeeds, perform a planned reboot and verify the startup task.

For a more direct process check, use Task Manager after reconnecting. You can also query common MetaTrader process names from Command Prompt:

tasklist /FI "IMAGENAME eq terminal.exe"
tasklist /FI "IMAGENAME eq terminal64.exe"

The process name alone is not proof that trading or automation is working, so pair it with the application’s journal or log.

Troubleshooting: programs still stop after closing RDP

The program closes immediately. You probably selected Sign out or Log off, or a script is logging off the user. Reconnect and repeat Step 1, then check the session state with query user.

It works for a few minutes, then stops. Review the Session Time Limits policies. Microsoft notes that idle, active-session, and disconnected-session limits can create different disconnect behavior. Check both Computer Configuration and User Configuration, and ask the server administrator about domain policy if the settings revert.

The program is open, but the EA or bot is not doing work. Check its connection, login, automation toggle, journal, and error log. Some GUI automation depends on an interactive desktop, focus, display settings, or a local device; disconnecting RDP cannot make every GUI program behave like a Windows service.

Everything disappears after a reboot. RDP disconnect and Windows restart are separate events. Add the program to the Startup folder or create a tested Task Scheduler task, then verify that the correct Windows account signs in and that the program can reconnect.

A new desktop appears when you reconnect. Use the same Windows username and avoid starting a second session with a different account. If the original session is still disconnected, reconnecting to that account should restore its open windows.

FAQ

Does closing RDP stop MT4 or MT5?

Normally, no. Closing the RDP client disconnects your view while the Windows session and its programs remain on the VPS. Signing out, shutting down, a session policy, or a reboot can close the terminal, and the terminal’s own connection or automation settings still matter.

How do I close RDP without logging off?

Close the RDP client window with X and confirm the disconnect prompt if one appears. Do not choose Sign out, Log off, Restart, or Shut down from the remote Windows Start menu.

Why does my program stop when I close Remote Desktop?

The usual causes are signing out instead of disconnecting, a policy that ends disconnected sessions, a reboot, or an application that requires an interactive desktop. Check query user, the Session Time Limits policies, Windows Event Viewer, and the application’s own log.

Can I leave a Windows VPS running without keeping RDP open?

Yes. That is a standard reason to use a VPS: you connect to manage the desktop, then disconnect while the server remains powered on. Test your application after disconnecting and separately configure startup recovery if it must return after a reboot.

Samrat Ghosh
Written by

Samrat Ghosh

Founder & Infrastructure Engineer

Samrat Ghosh is the founder of VPSLake, where he builds and runs the remote desktop and VPS hosting infrastructure the company is built on. He writes hands-on guides about RDP, Windows Server, VPS management and secure remote access - the practical documentation he wishes had…

Previous Article

How to Enable BBR on CentOS Stream 10 (Step-by-Step)

Next Article

How to Enable BBR on Debian 11 (Step-by-Step)

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨