How to start MetaTrader automatically after a VPS Reboot

DigitalForex is designed with stability as a primary goal. At the same time, our engineering team utilizes active monitoring to proactively detect problems and take preventative measures, minimizing any impact failing host node hardware could have on your environment. However, an unexpected reboot of your Forex VPS may occur anytime. In this guide, we will show you how to setup your Windows VPS so it will automatically start up all of your MT4 terminals after a system reboot.

There are two standard solutions to start a program automatically after the server reboots: use Task Scheduler or make the program start as a Windows service at bootup.

These solutions work for some situations when the program you need to start only needs to run as a background (unseen) process. In this tutorial, we will address how to automatically log in a user and launch a Metatrader terminal when the system reboots.

How to Automatically Launch a Metatrader terminal

First, download a Microsoft provided program called Autologon.exe

Autologon enables you to configure Windows’ built-in autologon mechanism easily. Instead of waiting for a user to enter their name and password, Windows uses the credentials you enter with Autologon, which are encrypted in the Registry, to log on the specified user automatically.

After extracting the .zip, run Autologon.exe and enter the credentials for the Windows user you are currently using (for example, Administrator). Click Enable.

Now, the Administrator user will log in automatically after the system is rebooted.

Next, open Task Scheduler (Administrative Tools -> Task Scheduler), and click Create Task… in the right-hand menu. Fill in each of the settings tabs with the options below. In the third tab Actions choose the .exe program you want to run automatically:

 General Tab: Fill in a name. Select “Run only when user is logged on.”

Triggers Tab: Click “New…” and then select Begin the task: At log on. Set it to Specific user: and then choose your user (Administrator). Click OK to save thetrigger.

Actions Tab: Click “New…” and then select Action: Start a program. Click “Browse…” and browse to the terminal.exe file of the Metatrader you want to launch automatically.

The last 2 tabs should remain with the default settings. Click OK to save the new task!

Now, create a second task. This time, we will use exactly the same settings to launch a Windows service. This will disconnect the user from the local desktop after your program is launched while leaving the user account running and open to access via Remote Desktop Connection or another login.

Use all of the same settings for this task as the previous one, but choose the program C:\Windows\System32\rundll32.exe, and fill in Add arguments (optional) with “user32.dll, LockWorkStation”.

Click OK to save the second task. Now you should have 2 new tasks in Task Scheduler, which you can find under Active Tasks in Task Scheduler:

Confirm the configuration by rebooting your Forex VPS. Next time you connect with Remote Desktop, or via the local terminal, the Metatrader terminal should be open and running.

Note: You can repeat the first task as many times as you need if newMetaTrader terminals should be started automatically.

The walk-through above was performed on Windows Server 2012 R2. If you need any help, you can contact our support team or just leave a comment here.