---
title: "How to setup your FiveM server as a windows service"
description: "Keep FXServer running using txAdmin or an NSSM Windows service, configure crash auto-restarts, and learn when to combine both tools."
url: "https://www.gameserverkings.com/knowledge-base/fivem/running-as-service/"
category: "FiveM"
category_url: "https://www.gameserverkings.com/knowledge-base/fivem/"
published: "2026-07-02T01:50:04.279Z"
updated: "2026-07-31T23:04:36.559Z"
source_format: "markdown"
site: "GameServerKings"
---

# How to setup your FiveM server as a windows service

Running the server in a PowerShell window means it dies when you close the window or log out of RDP. For production, run FXServer either as a Windows service (via NSSM) or under txAdmin's process manager. This guide covers both. Complete [Setup](/knowledge-base/fivem/setup/) and [Configuring your FiveM server](/knowledge-base/fivem/configuration-overview/) first.

## Which Option Should I Use?

| | NSSM | txAdmin |
|--|------|---------|
| Setup effort | Moderate | Easy |
| Web UI | No | Yes (console, players, restarts) |
| Scheduled restarts | Via Task Scheduler | Built in |
| Player management UI | No | Yes |
| Best for | Minimal, headless setups | Most production servers |

> [!TIP] Pick txAdmin unless you need a bare service
> Most production FiveM setups use **txAdmin**. It is the recommended approach for almost everyone. Use NSSM if you specifically want a bare Windows service with no web layer.

## Option A: txAdmin (Recommended)

txAdmin is a web-based admin panel that ships inside FXServer. It adds restart scheduling, player management, a live console, and resource management.

### Step 1: Launch Into txAdmin Setup Mode

Start the server **without** the `+exec server.cfg` argument:

```powershell
cd C:\FXServer-data
C:\FXServer\FXServer.exe
```

FXServer launches into txAdmin setup mode and prints a URL like:

```
[c-scripting-core] Started resource txAdmin
[txAdmin] Starting...
[txAdmin] Web Panel is running at: http://localhost:40120
```

### Step 2: Complete the Web Setup

1. Open that URL in a browser (use the server's public IP instead of `localhost` if you are setting up remotely, and open port 40120 in the firewall temporarily).

2. txAdmin walks you through:

   - Linking your Cfx.re account
   - Importing your existing `C:\FXServer-data` folder
   - Pointing at your `server.cfg`
   - Starting the server

3. Set an admin username and password for txAdmin itself (separate from your in-game admin identifiers).

### Step 3: Use txAdmin

From the txAdmin panel you get:

- A live console (send commands, watch output)
- Player list with kick, ban, warn
- Scheduled restarts (set a daily restart with in-game warnings)
- Resource start/stop/restart without a full server reboot
- Server performance graphs

txAdmin keeps the server process alive and can auto-restart it on crash. For it to survive a Windows reboot, run txAdmin's own FXServer process under NSSM (below) or set up a scheduled task that launches it on system startup.

### Securing the txAdmin Port

> [!WARNING] Leaving the txAdmin port public exposes your server
> Port 40120 (the txAdmin web UI) should not be left open to the public.

Either:

- Close it in the firewall and access txAdmin only over RDP / localhost, or
- Restrict the firewall rule to your own IP address

## Option B: NSSM (Bare Windows Service)

NSSM (Non-Sucking Service Manager) wraps any executable as a Windows service. Download from `nssm.cc`.

### Step 1: Install the Service

1. Extract `nssm.exe` to `C:\nssm\`.

2. From PowerShell as Administrator:

   ```powershell
   cd C:\nssm
   .\nssm.exe install FXServer
   ```

3. In the GUI that opens:

   - **Path**: `C:\FXServer\FXServer.exe`
   - **Startup directory**: `C:\FXServer-data`
   - **Arguments**: `+exec server.cfg`

4. On the **I/O** tab, set:

   - **Output (stdout)**: `C:\FXServer-data\logs\stdout.log`
   - **Error (stderr)**: `C:\FXServer-data\logs\stderr.log`

5. Click **Install service**.

### Step 2: Start the Service

```powershell
Start-Service FXServer
```

It will now auto-start when the Windows server reboots.

### Managing the NSSM Service

```powershell
Start-Service FXServer       # Start
Stop-Service FXServer        # Stop
Restart-Service FXServer     # Restart
Get-Service FXServer         # Check status
```

To remove the service later:

```powershell
C:\nssm\nssm.exe remove FXServer confirm
```

### Scheduled Restarts With NSSM

NSSM does not schedule restarts on its own. Use Windows Task Scheduler:

1. Open Task Scheduler.

2. Create a task that runs `Restart-Service FXServer` (via `powershell.exe -Command "Restart-Service FXServer"`).

3. Trigger it daily at a low-population hour (e.g., 5 AM).

> [!WARNING] NSSM restarts are abrupt
> For player-facing restart warnings, txAdmin is much better.

## Combining Both

A common production pattern: run txAdmin for its web UI and scheduling, and wrap txAdmin's launch under NSSM so the whole thing survives reboots. Point the NSSM service at the txAdmin launch command instead of the direct `+exec server.cfg`.

## Common Issues

- **Service starts then immediately stops**: Check the stdout/stderr logs you configured. Usually a `server.cfg` error or a missing license key.
- **txAdmin web panel unreachable remotely**: Port 40120 is not open, or you are using `localhost` from a remote browser. Open the port (temporarily and restricted to your IP) or tunnel over RDP.
- **Server does not restart after Windows reboot**: The NSSM service startup type may be Manual. Set it to Automatic in `services.msc`.

## What to Read Next

- [Database and Frameworks](/knowledge-base/fivem/database-and-frameworks/) for ESX, QBCore, and MySQL
- [OneSync, Updates, and Backups](/knowledge-base/fivem/onesync-updates-backups/) for scaling and maintenance
- [Configuring your FiveM server](/knowledge-base/fivem/configuration-overview/) to revisit `server.cfg` settings

---

Made with 💜 by GameServerKings
