How to Auto Start a Game Server After a Reboot (Windows and Linux)
Make a home game server start by itself after Windows Update restarts, power cuts and crashes: Startup folder, Task Scheduler, NSSM and systemd examples.
Updated Oct 7, 2026 · 5 min read
On this page
- Step 0: a start script that works by hand
- Add a crash restart loop
- Windows option 1: the Startup folder (easiest)
- Windows option 2: Task Scheduler at startup
- Windows option 3: a service with NSSM
- Linux: a systemd service
- Docker users
- Power cuts: BIOS setting
- Do not forget the rest
- A server that restarts itself without scripts
- FAQ
To make a home game server start automatically after a reboot, on Windows either put a shortcut to your start script in the Startup folder (shell:startup, simple but only runs after you sign in) or create a Task Scheduler task with the trigger At startup and Run whether user is logged on or not. For a server that should also restart after crashes, wrap it in a restart loop or run it as a service with NSSM. On Linux, create a systemd unit with Restart=on-failure and enable it. Pair any of these with the BIOS option to power on after a power cut.
Step 0: a start script that works by hand
Every method below runs a script. Make sure it works when you double click it first.
Minecraft (Windows), start.bat in the server folder:
@echo off
cd /d "%~dp0"
java -Xms2G -Xmx4G -jar server.jar nogui
Valheim (Windows), the server ships with start_headless_server.bat. Copy it, edit the name, world and password in your copy, and use that.
Use full paths everywhere, or cd /d "%~dp0" as above, because Task Scheduler starts scripts in C:\Windows\System32 unless told otherwise.
Add a crash restart loop
A loop brings the server back when it crashes or someone stops it with a command:
@echo off
cd /d "%~dp0"
:start
java -Xms2G -Xmx4G -jar server.jar nogui
echo Server stopped. Restarting in 10 seconds. Close this window to cancel.
timeout /t 10
goto start
The 10 second pause gives you a chance to close the window if you meant to stop it.
Windows option 1: the Startup folder (easiest)
- Press Win + R, type
shell:startup, press Enter. - Right click inside the folder, New, Shortcut, and point it at your
start.bat. - In the shortcut's Properties, set Start in to the server folder.
The server starts when you sign in. To make it start after an unattended reboot, Windows also has to sign in automatically. That means storing your password for auto sign in, which is a security trade off on a shared PC. If that bothers you, use option 2.
Windows option 2: Task Scheduler at startup
This starts the server at boot without anyone signing in.
- Open Task Scheduler and click Create Task (not Create Basic Task).
- General tab: name it
Game server. Choose Run whether user is logged on or not. Tick Run with highest privileges if the server needs it. - Triggers tab: New, Begin the task: At startup. Optionally set Delay task for: 1 minute so the network is ready.
- Actions tab: New, Start a program. Program: the full path to your
.bat. Start in: the server folder. - Settings tab: untick Stop the task if it runs longer than 3 days. Otherwise Windows kills your server after three days.
- Conditions tab: untick Start the task only if the computer is on AC power on laptops.
- Click OK and enter your Windows password.
The catch: the server runs in the background with no console window. Use RCON or the game's admin tools to manage it, and check log files for errors.
Windows option 3: a service with NSSM
NSSM (the Non-Sucking Service Manager) wraps any program as a Windows service, with automatic restarts after crashes.
- Download NSSM and extract it.
- In an admin Command Prompt:
nssm install ValheimServer
- In the window that opens, set Path to the server executable or your
.bat, Startup directory to the server folder, and Arguments if needed. - On the Exit actions tab, choose Restart application.
- Click Install service, then start it with
nssm start ValheimServer.
Services start before anyone signs in and restart on crashes. Like Task Scheduler, there is no console window.
Linux: a systemd service
Create /etc/systemd/system/valheim.service:
[Unit]
Description=Valheim dedicated server
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=steam
WorkingDirectory=/home/steam/valheim
ExecStart=/home/steam/valheim/start_server_custom.sh
Restart=on-failure
RestartSec=15
KillSignal=SIGINT
TimeoutStopSec=60
[Install]
WantedBy=multi-user.target
Then:
sudo systemctl daemon-reload
sudo systemctl enable --now valheim
journalctl -u valheim -f
KillSignal=SIGINT lets servers that save on Ctrl+C (Valheim does) shut down cleanly on systemctl stop. Run the server as its own non root user.
If you need an interactive console (Minecraft's), start it inside tmux or screen from the service, or use RCON with a tool such as mcrcon.
Docker users
If your server runs in Docker, restart: unless-stopped in compose.yaml does all of this for you, as long as Docker itself starts on boot (sudo systemctl enable docker). See running a game server in Docker at home.
Power cuts: BIOS setting
Auto start only helps if the PC turns on. In the BIOS or UEFI setup, find Restore on AC Power Loss, AC Back, Power On After Power Fail or similar (usually under Power or Advanced), and set it to Power On or Last State.
Do not forget the rest
- Sleep and updates: stop Windows sleeping and restarting while hosting.
- A fixed local IP so your port forward still points at the PC after the reboot: see how to port forward a game server.
- Backups, because an unexpected power loss mid save can damage a world: how to back up a game server.

A server that restarts itself without scripts
Auto start scripts, services and BIOS settings exist to make a home PC act like a server. A hosted server already is one: GamezServers servers run independently of your PC, with start, stop and restart buttons in the panel, a live console you can open from anywhere, and one click backups. See how to keep a game server online 24/7 without your PC or the games page.
FAQ
How do I make my Minecraft server start when Windows starts?
Put a shortcut to start.bat in shell:startup if you sign in automatically, or create a Task Scheduler task with the At startup trigger if you do not.
Why does my Task Scheduler server stop after 3 days?
The default setting Stop the task if it runs longer than 3 days is ticked. Untick it in the task's Settings tab.
Can I see the console if the server runs at startup?
Not with Task Scheduler or a service. Use RCON, the game's admin tools, or the Startup folder method, which opens a normal window after sign in.
How do I restart a game server automatically when it crashes?
Use a restart loop in the batch file, NSSM's restart on exit, or Restart=on-failure in a systemd unit.
Want a server without the setup?
From75¢
Pick a game, pay, play. Live the moment checkout finishes.