Skip to content

Update Steam server automatically

Frederik Hjorslev edited this page May 21, 2020 · 2 revisions

Update Steam server automatically

Introduction

This guide will show a way of updating of a Steam based server automatically by also taking into consideration if the server is populated or not before actually updating the server.

NB! This script does not take backup into consideration, so please have your own solution at hand in terms of backing up configurations etc. so you easily can revert, if needed.

Requirements

  1. Game server ...
  2. PowerShell module SteamPS
  3. Game server running as a Windows service
  4. Optional: Discord webhook for a channel

1. Install SteamPS

First, we need to install the SteamPS.

  1. Run the following from an elevated prompt:
Install-Module -Name SteamPS

When SteamPS is installed we will need to use the cmdlet from the module to install SteamCMD.

  1. This is done by calling Install-SteamCMD from an elevated prompt:
Install-SteamCMD

Optional: By using the parameter -InstallPath you can specify a custom install location of SteamCMD.

2. Game server running as a Windows service

You will need to have your game server running as a Windows service. I use FireDaemon Pro to do this, but you can also find free alternatives. See for example How to Run Any Program as a Background Service in Windows or Run as Service.

3. Send a message to Discord when script is executed

I have set the script to run every night. In order to keep track of what happens, without logging on to the server, I use the module PSDiscord to send messages to a Discord channel.

You will need to create a webhook in the Discord channel you want notifications sent to. Have the webhook URL in mind.

Updating the server

Per default, all servers are installed at C:\DedicatedServers\$ServiceName. This can be altered using the -Path parameter.

This example is aimed at the game Ground Branch, but will probably work for any game server that can be updated through SteamCMD and uses Steamworks.

In the below examples there are four parameters: AppID, ServiceName, RSIServerID and DiscordWebhookUri.

  • AppID is the Steam Application ID - you can find it at steamdb.info or by using the cmdlet Find-SteamAppID.
  • ServiceName is the Windows Service Name. You will define it yourself when creating the Windows Service.
  • IPAddress of the server.
  • Port number of the server.
  • DiscordWebhookUri is created when you create a webhook for the Discord channel.
Update-SteamServer -AppID 476400 -ServiceName 'GB-PG10' -IPAddress '185.15.73.207' -Port 27015 -DiscordWebhookUri 'https://discordapp.com/api/webhooks/....'
  1. Update-SteamServer will fetch the server info to check if the server is empty. If not, it will wait until the server is empty before updating.
  2. It will stop the server by stopping the Windows Service named GB-PG10.
  3. It will update the server.
  4. When the server is updated it will check to see that the server is online. Default is to check every minute for a maximum of 10 times before the server is declared offline.
    1. By specifying the parameter -DiscordWebhookUri you can have a notification if the server fails to update.
    2. If you specify the parameter -AlwaysNotify alongside -DiscordWebhookUri you will always receive a message with a status of the server update.