If your game server only starts when you log in and double-click it, every restart (a Windows update, a restart from the panel) leaves it off until you notice. With Task Scheduler it starts by itself when Windows boots, without anyone logging in.
1. A .bat that starts the server
Create, for example, C:\servers\start.bat. The important part is the first line: move into the server folder before launching it.
@echo off
cd /d C:\FXServer\server
FXServer.exe
Change the folder and executable to your game's (for example java -Xms6G -Xmx6G -jar paper.jar nogui for Minecraft). Test it with a double-click first: if it does not start that way, it will not start scheduled either.
2. Schedule the task
In PowerShell as administrator:
schtasks /Create /TN "Game server" /SC ONSTART /DELAY 0001:00 /RU SYSTEM /RL HIGHEST /TR "C:\servers\start.bat"
/SC ONSTART: when Windows boots, even if nobody logs in./DELAY 0001:00: waits a minute so the network and database are ready./RU SYSTEM: runs in the background, like a service.
Test it without rebooting: schtasks /Run /TN "Game server".
What changes when started this way
The server runs in the background and you will not see its window when you log in over remote desktop. Manage it through its panel or remote console:
- FiveM: txAdmin, at
http://YOUR_IP:40120. - Minecraft, Rust, ARK...: over RCON, or in-game with admin rights.
To stop it: schtasks /End /TN "Game server", or from Task Manager. To disable it: schtasks /Change /TN "Game server" /DISABLE.
Bring it back up if it crashes
For games without a panel that restarts them (txAdmin does it for FiveM), a loop in the .bat launches it again when it closes:
@echo off
cd /d C:\servers\rust
:start
RustDedicated.exe -batchmode +server.port 28015 +server.identity "main"
timeout /t 10
goto start
If you ever want to stop it for good, disable the task first, or the loop will start it again.