WindowsPublished on May 27, 202613 min read

How to make a FiveM server on a Windows VPS

This guide shows how to create a FiveM server on a Windows VPS: install FXServer, the official Cfx.re server, from the Windows artifacts, then set it up with txAdmin. It also covers ports, the server.cfg file, automatic startup, backups and monitoring. The commands target Windows Server 2025, the system delivered on OuiHeberg Windows VPS.

FiveM also runs on Linux. Windows is still the easiest way to start: txAdmin, File Explorer and Task Scheduler work without a command line, and logs are easy to read.

Prepare the Windows VPS

Connect to the VPS over Remote Desktop with the main IP and password shown on the VPS page in the client area. The guide Connect to a Windows VPS via RDP explains the connection.

VPS page with the power buttons, the Console button and the tab menu

The resources you need depend on the player count and the framework.

Server typePlayersMemoryCPUStorage
Test or development1 to 164 GB2 vCPU40 GB
Light RP or deathmatch16 to 324 GB2 to 4 vCPU60 GB
Medium RP or racing32 to 648 GB4 vCPU80 GB
Serious RP (ESX, QBCore)64 to 12816 GB6 to 8 vCPU120 GB
High density128 to 25632 GB8 vCPU or more200 GB

With 8 GB and 4 vCPU, a well-tuned ESX or QBCore server hosts 32 to 64 players. Beyond that, trim your resources. Once connected, check free memory and disk space in PowerShell.

# Total and free memory (in KB)
Get-CimInstance Win32_OperatingSystem | Select-Object TotalVisibleMemorySize, FreePhysicalMemory
# Disk space
Get-PSDrive C | Select-Object Used, Free

Install Visual C++ and 7-Zip

FXServer needs the Visual C++ Redistributable. 7-Zip is used here to compress backups. To install them by hand, download Visual C++ 2015-2022 x64 from Microsoft and 7-Zip from its website.

This script does the same. Run it in PowerShell as administrator. winget, built into Windows Server 2025, always installs the latest 7-Zip.

# Download folder
New-Item -ItemType Directory -Force -Path "C:\FXServer\downloads"

# Visual C++ Redistributable 2015-2022 x64
$vcUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
$vcPath = "C:\FXServer\downloads\vc_redist.x64.exe"
Invoke-WebRequest -Uri $vcUrl -OutFile $vcPath
Start-Process -FilePath $vcPath -ArgumentList "/quiet /norestart" -Wait
Write-Host "Visual C++ installed." -ForegroundColor Green

# 7-Zip, for backups (latest version via winget)
winget install --id 7zip.7zip -e --accept-source-agreements --accept-package-agreements

Download FXServer

Keep the FXServer binaries apart from the server data. An update then replaces the binaries without touching your files.

C:\FXServer\
├── server\          ← FXServer binaries (FXServer.exe, etc.)
├── txData\          ← txAdmin data (created on first start)
└── server-data\     ← data, resources, server.cfg
    └── resources\
        └── [categories]\

The recommended build is on the Cfx.re Server Download page, which replaces the old artifacts list. This script reads the URL of that build, then downloads and extracts FXServer into C:\FXServer\server.

# Create the folders
New-Item -ItemType Directory -Force -Path "C:\FXServer\server"
New-Item -ItemType Directory -Force -Path "C:\FXServer\server-data\resources"

# Read the URL of the recommended build, the one on the Server Download page
$versions = Invoke-RestMethod "https://changelogs-live.fivem.net/api/changelog/versions/win32/server"
$artifactUrl = $versions.recommended_download
$downloadPath = "C:\FXServer\downloads\server.zip"

Write-Host "Downloading build $($versions.recommended)..." -ForegroundColor Cyan
Invoke-WebRequest -Uri $artifactUrl -OutFile $downloadPath

# Extract the archive to C:\FXServer\server
Expand-Archive -Path $downloadPath -DestinationPath "C:\FXServer\server" -Force
Write-Host "FXServer extracted to C:\FXServer\server" -ForegroundColor Green

For FiveM on GTA V Enhanced, the archive is called cfx-server_win_x64 and the executable cfx-server.exe, according to the Cfx.re documentation. The rest of this guide covers FiveM Legacy, with FXServer.exe.

To go back to a specific build or change version later, follow How to change the Artifact version of your FiveM server.


Get the license key on portal.cfx.re

Without a valid license key, FXServer will not start. The key is free. It is now created on portal.cfx.re, which replaces keymaster.fivem.net, with your Cfx.re account. Give it a name and the VPS main IP, without the port. The guide Keymaster FiveM: get your cfx.re server key covers each step.

Copy the key, which starts with cfxk_. txAdmin asks for it on first start. On a server without txAdmin, it goes into server.cfg with this exact syntax.

sv_licenseKey "cfxk_xxxxxxxxxxxx_xxxxxx"

Never share your key. It is tied to your Cfx.re account and to your server's IP.


Open the ports in the Windows Firewall

Players connect on port 30120, over TCP and UDP. The txAdmin web interface listens on TCP port 40120. The client area has no network firewall for VPS, so only the Windows Firewall matters. Run these commands in PowerShell as administrator.

# Port 30120 TCP (player connections)
New-NetFirewallRule -DisplayName "FiveM - TCP 30120" `
    -Direction Inbound -Protocol TCP -LocalPort 30120 `
    -Action Allow -Profile Any

# Port 30120 UDP (player connections)
New-NetFirewallRule -DisplayName "FiveM - UDP 30120" `
    -Direction Inbound -Protocol UDP -LocalPort 30120 `
    -Action Allow -Profile Any

# Port 40120 TCP (txAdmin)
New-NetFirewallRule -DisplayName "FiveM - txAdmin 40120" `
    -Direction Inbound -Protocol TCP -LocalPort 40120 `
    -Action Allow -Profile Any

Write-Host "FiveM ports opened." -ForegroundColor Green

Once FXServer is running, check that both ports are listening. A LISTENING line should appear for each one.

netstat -an | findstr "30120 40120"

txAdmin is password-protected, but you can restrict port 40120 to your own IP address. The guide How to open a port in Windows Firewall on a VPS shows how to limit a rule.


First start with txAdmin

Double-click C:\FXServer\server\FXServer.exe, or start it from PowerShell.

Start-Process -FilePath "C:\FXServer\server\FXServer.exe" -WorkingDirectory "C:\FXServer\server-data"

A console window opens and the VPS browser shows txAdmin at http://localhost:40120. From your PC, the address is the VPS IP followed by :40120.

  1. Check that the PIN is filled in, then click Link Account. Log in to your Cfx.re account and allow access.

  2. Create the password for the txAdmin admin interface.

  3. Give your server a name.

  4. In Popular Recipes, pick a recipe (see the table below).

  5. Choose the server folder. Enter C:\FXServer\server-data to keep the paths used in this guide.

  6. Paste your license key, then click Run Recipe.

  7. Finish with Save & Run Server.

RecipeUseDifficultyDatabase
CFX Default (Vanilla)Testing, demo, simple serverEasyNone
ESX LegacyClassic RP, wide choice of scriptsMediumMySQL or MariaDB
QBCore FrameworkModern RP, maintained scripts with frequent updatesMediumMySQL or MariaDB

To start, pick CFX Default. Move to ESX or QBCore once the server is stable. The txAdmin Recipe Deployer then downloads the framework and its dependencies and sets up the database.


Configure server.cfg

The server.cfg file, in the server folder, holds the main settings. Here is an up-to-date template.

# License key (portal.cfx.re)
sv_licenseKey "cfxk_YOUR_KEY_HERE"
# Name, description and banner are set on portal.cfx.re
sets tags "roleplay, fivem"

# Slots and privacy of player IP addresses
sv_maxclients 64
sv_endpointPrivacy true

# OneSync, recommended whatever the player count
set onesync on

# Security (strict blocks client-created entities, test it with your scripts)
sv_scriptHookAllowed 0
sv_entityLockdown strict

# GTA V build enforced on players (3889 = latest on 04/11/2026, list on docs.fivem.net)
sv_enforceGameBuild 3889

# Base resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure hardcap
ensure baseevents

# Add your resources here with 'ensure'
# ensure es_extended
# ensure qb-core

sv_maxclients sets the number of slots, from 1 to 2048. According to the Cfx.re documentation, 32 slots or more need OneSync, and more than 64 slots need set onesync on. The legacy mode is no longer recommended and only serves old scripts. The server name, description and tags are now set on portal.cfx.re, no longer with sv_hostname or sv_projectName.

Each ensure loads a resource into memory. Comment out the ones your server does not use.

# ensure unused_resource   ← comment out with #

An ESX server with around fifty well-chosen resources fits in 3 to 4 GB. With 150 poorly sorted resources, it easily goes past 12 GB. The guide How to configure server.cfg on your FiveM server covers the other options.


Manage resources

Resources go in server-data\resources. Square brackets ([core], [scripts]) mark categories. FiveM ignores them, they only help you stay organised.

C:\FXServer\server-data\resources\
├── [core]\
│   ├── es_extended\
│   └── qb-core\
├── [scripts]\
│   ├── esx_jobs\
│   └── qb-policejob\
└── [maps]\
    └── custom_map\

To add a resource by hand, for example es_extended, follow these steps.

  1. Download the resource, from GitHub for example.

  2. Extract it to C:\FXServer\server-data\resources\[core]\es_extended\.

  3. Check that the folder contains an fxmanifest.lua file (__resource.lua for older resources).

  4. Add this line to server.cfg.

ensure es_extended
CommandEffect
ensure resource_nameStarts the resource, or restarts it if it is already running. Use it in production.
start resource_nameStarts the resource once.

To reload a resource without restarting the server, open txAdmin, then Resources, and click Restart next to the resource. From the console, this command does the same.

restart resource_name

Start FXServer with Windows

Without this step, the FiveM server does not come back after a VPS restart. This scheduled task starts FXServer at boot under the SYSTEM account, even with no open session.

# Settings
$taskName    = "FiveM - FXServer AutoStart"
$fxExe       = "C:\FXServer\server\FXServer.exe"
$workingDir  = "C:\FXServer\server-data"
$logFile     = "C:\FXServer\logs\fxserver_startup.log"

# Log folder
New-Item -ItemType Directory -Force -Path "C:\FXServer\logs"

# Action: start FXServer
$action = New-ScheduledTaskAction `
    -Execute $fxExe `
    -WorkingDirectory $workingDir

# Trigger: at system startup, with a delay
$trigger = New-ScheduledTaskTrigger -AtStartup
$trigger.Delay = "PT30S"

# Settings: no time limit, 3 retries on failure
$settings = New-ScheduledTaskSettingsSet `
    -ExecutionTimeLimit (New-TimeSpan -Hours 0) `
    -RestartCount 3 `
    -RestartInterval (New-TimeSpan -Minutes 1)
# SYSTEM account, no open session needed
$principal = New-ScheduledTaskPrincipal `
    -UserId "SYSTEM" `
    -LogonType ServiceAccount `
    -RunLevel Highest

# Register the task
Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -Principal $principal `
    -Force

Write-Host "Scheduled task created: $taskName" -ForegroundColor Green

Check the task, then run it to test it. In the txAdmin settings, keep automatic server start enabled.

# List the FiveM tasks
Get-ScheduledTask | Where-Object { $_.TaskName -like "*FiveM*" }
# Run the task to test it
Start-ScheduledTask -TaskName "FiveM - FXServer AutoStart"

Back up the server automatically

Losing the characters, vehicles and houses of an RP server is a hard blow. Back up at least this data.

  • C:\FXServer\server-data\: resources, configuration and server.cfg.

  • C:\FXServer\txData\: txAdmin accounts and settings.

  • The MySQL or MariaDB database, if you use ESX or QBCore.

This script copies that data, exports the database, compresses everything and keeps 7 days of archives.

# ============================================
# FIVEM BACKUP, 7-day rotation
# ============================================
$sourceDir   = "C:\FXServer\server-data"
$txDataDir   = "C:\FXServer\txData"
$backupRoot  = "C:\FXServer\backups"
$retentionDays = 7
$date        = Get-Date -Format "yyyy-MM-dd_HH-mm"
$backupPath  = "$backupRoot\backup_$date"

# Create the backup folder
New-Item -ItemType Directory -Force -Path $backupPath

# Copy the server and txAdmin data
Write-Host "Backing up server-data..." -ForegroundColor Cyan
Copy-Item -Path $sourceDir -Destination "$backupPath\server-data" -Recurse -Force
Copy-Item -Path $txDataDir -Destination "$backupPath\txData" -Recurse -Force

# MySQL or MariaDB backup: replace the values with yours
$mysqlUser   = "root"
$mysqlPass   = "YOUR_PASSWORD"
$mysqlDb     = "essentialmode"  # or the database created by the recipe
$mysqldump   = "C:\xampp\mysql\bin\mysqldump.exe"  # adjust to your install

if (Test-Path $mysqldump) {
    Write-Host "Backing up the database..." -ForegroundColor Cyan
    & $mysqldump -u $mysqlUser -p$mysqlPass $mysqlDb --result-file="$backupPath\database_$date.sql"
    Write-Host "Database backed up." -ForegroundColor Green
}

# Compression
$7zExe = "C:\Program Files\7-Zip\7z.exe"
& $7zExe a "$backupRoot\backup_$date.7z" "$backupPath\*" -mx=5
Remove-Item -Path $backupPath -Recurse -Force
Write-Host "Backup compressed: backup_$date.7z" -ForegroundColor Green

# Rotation: delete backups older than 7 days
$cutoffDate = (Get-Date).AddDays(-$retentionDays)
Get-ChildItem -Path $backupRoot -Filter "backup_*.7z" |
    Where-Object { $_.LastWriteTime -lt $cutoffDate } |
    Remove-Item -Force
Write-Host "Rotation done. Backups kept: $retentionDays days." -ForegroundColor Green

Schedule it every day at 4 am.

$backupScript = "C:\FXServer\scripts\backup.ps1"
New-Item -ItemType Directory -Force -Path "C:\FXServer\scripts"
# Save the script above as $backupScript, then:
$action  = New-ScheduledTaskAction -Execute "powershell.exe" `
           -Argument "-NonInteractive -File `"$backupScript`""
$trigger = New-ScheduledTaskTrigger -Daily -At "04:00"
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
Register-ScheduledTask -TaskName "FiveM - Daily Backup" `
    -Action $action -Trigger $trigger -Principal $principal -Force
Write-Host "Automatic backup scheduled at 4 am." -ForegroundColor Green

Test an archive regularly to make sure it can be read.

# Test the integrity of an archive
$7zExe = "C:\Program Files\7-Zip\7z.exe"
& $7zExe t "C:\FXServer\backups\backup_2026-01-15_04-00.7z"

These archives stay on the VPS. To keep a copy of the whole VPS, the client area offers an automatic backup option, described in How to set up automatic VPS backups.


Monitor FXServer and restart it

txAdmin already monitors the game server and restarts it when it crashes. This watchdog also monitors the FXServer process itself, which runs txAdmin. It restarts it if it disappears and alerts your Discord server through a webhook.

# ============================================
# FXSERVER WATCHDOG: restart and Discord alerts
# ============================================
# Save this script as C:\FXServer\scripts\watchdog.ps1
$fxExe       = "C:\FXServer\server\FXServer.exe"
$workingDir  = "C:\FXServer\server-data"
$webhookUrl  = "https://discord.com/api/webhooks/YOUR_WEBHOOK"
$logFile     = "C:\FXServer\logs\watchdog.log"
$restartDelay = 15  # pause before restarting, in seconds

function Write-Log {
    param([string]$Message)
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    "$timestamp - $Message" | Out-File -FilePath $logFile -Append
    Write-Host "$timestamp - $Message"
}

function Send-DiscordAlert {
    param([string]$Title, [string]$Message, [int]$Color = 15158332)
    try {
        $payload = @{
            embeds = @(@{
                title       = $Title
                description = $Message
                color       = $Color
                timestamp   = (Get-Date).ToString("o")
            })
        } | ConvertTo-Json -Depth 8
        Invoke-RestMethod -Uri $webhookUrl -Method Post `
            -ContentType "application/json" -Body $payload
    } catch {
        Write-Log "Discord webhook error: $($_.Exception.Message)"
    }
}

Write-Log "Watchdog started."
Send-DiscordAlert -Title "FiveM watchdog" -Message "FXServer monitoring enabled." -Color 3066993

while ($true) {
    $process = Get-Process -Name "FXServer" -ErrorAction SilentlyContinue
    if (-not $process) {
        Write-Log "FXServer not found, restarting..."
        Send-DiscordAlert -Title "FXServer stopped" `
            -Message "FXServer is no longer running. Restarting in $restartDelay s." `
            -Color 15158332
        Start-Sleep -Seconds $restartDelay
        Start-Process -FilePath $fxExe -WorkingDirectory $workingDir
        Write-Log "FXServer restarted."
        Send-DiscordAlert -Title "FXServer restarted" `
            -Message "FXServer was restarted automatically." -Color 15844367
        Start-Sleep -Seconds 60  # let the server start before checking again
    }
    Start-Sleep -Seconds 30  # interval between two checks
}

Schedule it at startup, after FXServer.

$watchdogScript = "C:\FXServer\scripts\watchdog.ps1"
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
    -Argument "-NonInteractive -WindowStyle Hidden -File `"$watchdogScript`""
$trigger = New-ScheduledTaskTrigger -AtStartup
$trigger.Delay = "PT60S"  # starts after FXServer
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Hours 0)
Register-ScheduledTask -TaskName "FiveM - Watchdog" `
    -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force
Write-Host "Watchdog scheduled at startup." -ForegroundColor Green

txAdmin logs are in the logs folder of its profile, default by default.

C:\FXServer\txData\default\logs\

The fxserver.log file keeps the server console. That is where you look for the cause of a crash.


Update or migrate the server

Update FXServer

  1. Download the new recommended build, with the download script or from the Server Download page.

  2. Stop FXServer from txAdmin.

  3. Replace the files in C:\FXServer\server\ with the new ones, without touching server-data\ or txData\.

  4. Start FXServer again.

Your resources, settings and data are never overwritten by a binary update.

Migrate an existing server to this VPS

Back up server-data\, txData\ and the database on the old server. Install FXServer on the new VPS with this guide, then restore the files and the database. Finally, update the key's IP on portal.cfx.re.


Fix common errors

ErrorLikely causeFix
License key not foundKey missing or mistypedCheck sv_licenseKey "cfxk_..." in server.cfg
Server missing from the FiveM listClosed ports or wrong IP on the keyCheck the firewall, netstat -an and the key's IP on portal.cfx.re
txAdmin unreachablePort 40120 blockedCreate the rule for TCP port 40120
FXServer crashes at startupVisual C++ missing or damagedReinstall Visual C++ 2015-2022 x64 from Microsoft
OneSync is not enabledDirective missing from server.cfgAdd set onesync on
Memory full, slow serverToo many active resourcesDisable unused resources or add memory to the VPS
Players cannot connectMissing firewall ruleCheck the Windows inbound rules, then open a ticket if the problem persists

The Cfx.re documentation and the Cfx.re forum answer questions about scripts and frameworks. FiveM and RedM, its counterpart for Red Dead Redemption 2, both use FXServer, but their resources are not compatible.


Need help?

Open a ticket from Tickets › Open a Ticket, or from the Contact support tile at the bottom of the VPS page. In the Related Service field, pick the VPS so the team saves time. You can also ask your question on the OuiHeberg Discord.

Was this article helpful?

488 views
Share this article
Need a Windows VPS?

Windows Server 2025 with the license included, Remote Desktop access and management from the client area.

View plans →

Related Articles