Metatrader configuration gone when Metatrader auto-start when VPS restart?

 

I have been scouring posts in forum and internet search but unable to find proper solution to this issue.

When VPS restart, I already setup windows auto login to administrator account and auto start Metatrader apps by placing shortcut in startup folder. Windows auto login works fine, and metatrader apps also launching fine after auto login.

The problem is all metatrader apps launched after auto-login don't load the configuration, it's like setting up brand new installation and prompt me for MT4/MT5 server name and login account again.

All of metatrader apps are installed under default Administrator user in Windows Server 2022.

The weird thing is, after auto-login work and all those metratrader apps launched -- close all of them because configuration not loaded, then re-launch them again manually one by one in the same administrator login, they all works normally and able to load all configuration correctly.

Only when they are launched after auto-login, they are all lke brand new installation.


Has anybody experienced this issue and know how to resolve it?

VPS server is using Windows Server 2022 Datacenter edition, auto login is configured to login into default Administrator account, all MT4 and MT5 apps are installed under default Administrator account


Thank you

 
hk.trade:


Thank you

If i remember correctly, this only happens when you run metatrader as administrator.

if you run metatrader as any user, even with administrator rights, your previous chart setup will load normally.
 
Michael Charles Schefe #:

If i remember correctly, this only happens when you run metatrader as administrator.

if you run metatrader as any user, even with administrator rights, your previous chart setup will load normally.

Thanks Michael -- I'll give this a try

 
Michael Charles Schefe #:

If i remember correctly, this only happens when you run metatrader as administrator.

if you run metatrader as any user, even with administrator rights, your previous chart setup will load normally.

I tried creating new windows login account, give admin access but unfortunately, this problem still happening

 
hk.trade #:

I tried creating new windows login account, give admin access but unfortunately, this problem still happening

strange. i will pin this page to my browser to see if anyone gives idea that fixes your issue. good luck.

 
hk.trade:

I have been scouring posts in forum and internet search but unable to find proper solution to this issue.

When VPS restart, I already setup windows auto login to administrator account and auto start Metatrader apps by placing shortcut in startup folder. Windows auto login works fine, and metatrader apps also launching fine after auto login.

The problem is all metatrader apps launched after auto-login don't load the configuration, it's like setting up brand new installation and prompt me for MT4/MT5 server name and login account again.

All of metatrader apps are installed under default Administrator user in Windows Server 2022.

The weird thing is, after auto-login work and all those metratrader apps launched -- close all of them because configuration not loaded, then re-launch them again manually one by one in the same administrator login, they all works normally and able to load all configuration correctly.

Only when they are launched after auto-login, they are all lke brand new installation.


Has anybody experienced this issue and know how to resolve it?

VPS server is using Windows Server 2022 Datacenter edition, auto login is configured to login into default Administrator account, all MT4 and MT5 apps are installed under default Administrator account

No, but I can certainly help you debug the issue.  First off, you should not be using the default Administrator account; this can cause weird issues.  Feel free to create a new, local user called "Admin" by executing the following two commands in an elevated cmd window:

net user /add Admin
net localgroup Administrators Admin /add

Then log out, and you should see the new Admin user on your login screen.  Next, you mentioned that the VPS server is on a machine running Windows Server.  In a server environment, computers often make use of Network Attached Storage to load the roaming AppData folder upon login.  If something like this is a possibility in your setup, perhaps MetaTrader is being launched too soon, before this folder is fully ready.  You can delay its auto start by using the batch file below in your Startup folder (e.g. C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) instead of the MetaTrader shortcut(s).  Copy the script below, paste it into Notepad, change as needed (to start the specific MetaTrader applications you're using), save it to your desktop with a name like "DelayedStart.bat", and then move it to your startup folder (feel free to copy the path above, as the path is long and the AppData folder is normally hidden).

@echo off
echo Starting MetaTrader soon...
timeout 60

start /d "C:\Program Files\MetaTrader 4" terminal64.exe
timeout 10

start /d "C:\Program Files\MetaTrader 5" terminal64.exe
timeout 10

exit /b 0

Assuming everything was done correctly, when you restart the PC, it should boot to the desktop with a cmd window counting down for a minute.  Then the first MetaTrader should open (and so on).  Don't forget to change the auto-login from your default administrator account to the new Admin account too.

 
Shalem Loritsch #:

No, but I can certainly help you debug the issue.  First off, you should not be using the default Administrator account; this can cause weird issues.  Feel free to create a new, local user called "Admin" by executing the following two commands in an elevated cmd window:

Then log out, and you should see the new Admin user on your login screen.  Next, you mentioned that the VPS server is on a machine running Windows Server.  In a server environment, computers often make use of Network Attached Storage to load the roaming AppData folder upon login.  If something like this is a possibility in your setup, perhaps MetaTrader is being launched too soon, before this folder is fully ready.  You can delay its auto start by using the batch file below in your Startup folder (e.g. C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) instead of the MetaTrader shortcut(s).  Copy the script below, paste it into Notepad, change as needed (to start the specific MetaTrader applications you're using), save it to your desktop with a name like "DelayedStart.bat", and then move it to your startup folder (feel free to copy the path above, as the path is long and the AppData folder is normally hidden).

Assuming everything was done correctly, when you restart the PC, it should boot to the desktop with a cmd window counting down for a minute.  Then the first MetaTrader should open (and so on).  Don't forget to change the auto-login from your default administrator account to the new Admin account too.

Thank you for these suggestions -- I'll try this during weekend when I can freely restart the VPS multiple times.

Maybe worth to add info:

I have another VPS with the same provider, same Windows 2022 datacenter edition. Let's call it VPS 1 (that has metatrader problem) and VPS 2. In VPS 2, I use the same automatic logon app from Microsoft, set it to logon to default Administrator account, and metatrader app launch correctly without any issue. I place few metatrader shortcuts on the startup folder. Windows automatically logon correctly, metatrader apps all launching automatically and correctly.

At least, this lead me to believe, there's certain windows setting / configuration that may be different in VPS 1 and causing this issue?

 

I have this issue as well (Win Server 2012).

Using task scheduler, I created an action of ONLY launching MT5 under the only (Administrator) account. When you run the task...it opens fine. I have also used the native windows utility netplwiz to login automatically.

So it's either time (after login), or the trigger type, or maybe permissions that's causing the issue.

I used a trigger of a specific time and that loaded MT5 fine.

I tried the batch autorun with 60, 120, 240 seconds. Same thing.


I think it might be permissions of the account that's executing the task/batch/.exe.


Very weird. 

 
Shalem Loritsch #:

No, but I can certainly help you debug the issue.  First off, you should not be using the default Administrator account; this can cause weird issues.  Feel free to create a new, local user called "Admin" by executing the following two commands in an elevated cmd window:

Then log out, and you should see the new Admin user on your login screen.  Next, you mentioned that the VPS server is on a machine running Windows Server.  In a server environment, computers often make use of Network Attached Storage to load the roaming AppData folder upon login.  If something like this is a possibility in your setup, perhaps MetaTrader is being launched too soon, before this folder is fully ready.  You can delay its auto start by using the batch file below in your Startup folder (e.g. C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) instead of the MetaTrader shortcut(s).  Copy the script below, paste it into Notepad, change as needed (to start the specific MetaTrader applications you're using), save it to your desktop with a name like "DelayedStart.bat", and then move it to your startup folder (feel free to copy the path above, as the path is long and the AppData folder is normally hidden).

Assuming everything was done correctly, when you restart the PC, it should boot to the desktop with a cmd window counting down for a minute.  Then the first MetaTrader should open (and so on).  Don't forget to change the auto-login from your default administrator account to the new Admin account too.

Hi Shalem,

I tried with auto-logon setup both with default Administrator account and new account and then place that batch file in startup folder -- the result is still the same. Windows automatically log on to the account correctly, then cmd window show up, then Metatrader application launched after delay and it's launched like as if new installation. It prompt you to select broker server and mt account info.

Then I close that metatrader application, then launch the startup batch file again -- this time, metatrader applicaiton launch correctly and load my settings.

I played around with the batch script and added time to 120, 150, 190, even to 240 but still the same. When metatrader app launched from auto logon, it's like brand new installation.

Please advise next step/troubleshoot that I can do after this


@echo off
echo Starting MetaTrader soon...
timeout 240

start "" "C:\Program Files (x86)\PU Prime MT4 Terminal\terminal.exe"
timeout 10

exit /b 0
 
Mark David Harvey Brewster #:

I have this issue as well (Win Server 2012).

Using task scheduler, I created an action of ONLY launching MT5 under the only (Administrator) account. When you run the task...it opens fine. I have also used the native windows utility netplwiz to login automatically.

So it's either time (after login), or the trigger type, or maybe permissions that's causing the issue.

I used a trigger of a specific time and that loaded MT5 fine.

I tried the batch autorun with 60, 120, 240 seconds. Same thing.


I think it might be permissions of the account that's executing the task/batch/.exe.


Very weird. 

Glad that I'm not the only one -- seems like not many people getting this issue though, so I thought it's just me.

Did you manage to solve this problem? if yes, do you mind to share?

 
hk.trade #:

I tried with auto-logon setup both with default Administrator account and new account and then place that batch file in startup folder -- the result is still the same. Windows automatically log on to the account correctly, then cmd window show up, then Metatrader application launched after delay and it's launched like as if new installation. It prompt you to select broker server and mt account info.

Then I close that metatrader application, then launch the startup batch file again -- this time, metatrader applicaiton launch correctly and load my settings.

I played around with the batch script and added time to 120, 150, 190, even to 240 but still the same. When metatrader app launched from auto logon, it's like brand new installation.

That is weird.  I am not aware of Explorer launching startup programs with any environmental conditions that would be different than those it uses when the user manually clicks an icon to open a program.  While I doubt this is the issue (based on its behavior differing from autologon versus manual launch both via the batch file), the exact syntax of the start command with the "/d" flag and separating the application's directory from "terminal.exe" was very important to ensure that the current ("start in") directory was correct; the start command should have read:

start /d "C:\Program Files (x86)\PU Prime MT4 Terminal" terminal.exe

Feel free to test the above, but failing that, let's remove the Startup folder batch file and try to launch MetaTrader via the Task Scheduler—an entirely different method/infrastructure than Explorer's Startup folder.  Right-click your Windows Start button, click Computer Management -> Task Scheduler -> Task Scheduler Library -> Action (menu) -> Create Task...
Name the task "Autostart MT4 PU Prime".  The default user settings should be correct (your user account, run only when the user is logged on).  Configure for Windows 10.
For Triggers, select At log on -> Specific user -> (defaults should be correct, your user account).  Delay task for 1 minute.
For Actions, create a new one, browse to "C:\Program Files (x86)\PU Prime MT4 Terminal", and select terminal.exe.
For Conditions, make sure they're all unticked.
For Settings, untick Stop the task if it runs longer than.
Click [OK].  If you have a logon password, it will probably ask for it here; if so, enter it to finish creating the scheduled task.  Then, make sure that MetaTrader is closed, right-click your new task, and click Run.
It should appear on the screen and load your settings as expected.  Assuming it does, restart your PC and see if it autostarts correctly.

If it starts correctly when manually running the scheduled task, but doesn't autostart correctly upon reboot, here's another thing we could try: Go back to the "Autostart MT4 PU Prime" task you created in Computer Management, go to the Triggers tab, and remove the At log on trigger (so there are no triggers).  Now, make sure MetaTrader is closed, open a command window, and execute this command:

schtasks /run /i /tn "Autostart MT4 PU Prime"

Does it load correctly this way?  If so, create a batch file in your Startup folder (like you did before), but with this code:

@echo off
echo Starting MetaTrader soon...
timeout 60

schtasks /run /i /tn "Autostart MT4 PU Prime"
timeout 10

exit /b 0

If after all this, manual launches (right-click -> run task, or manually executing the task run command) work, but none of the automated methods work, my conclusion would be that there is something unusual going on environmentally with your system, possibly even related to user input or antivirus software.  This could be very difficult to debug; but note that I am a very in-depth developer/debugger—it would be a matter of how much we want to go back and forth to figure out a solution!

Do be aware that changing your login password could break the task and your autologon feature; both would have to be manually reconfigured with the new password.  Feel free to disable or delete the "Autostart MT4 PU Prime" task you created if it's no longer needed.