-
Notifications
You must be signed in to change notification settings - Fork 13
Update Steam server automatically
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.
- Game server ...
- PowerShell module SteamPS
- Game server running as a Windows service
- Optional: Discord webhook for a channel
First, we need to install the SteamPS.
- 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.
- 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.
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.
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.
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/....'
-
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. - It will stop the server by stopping the Windows Service named GB-PG10.
- It will update the server.
- 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.
- By specifying the parameter
-DiscordWebhookUri
you can have a notification if the server fails to update. - If you specify the parameter
-AlwaysNotify
alongside-DiscordWebhookUri
you will always receive a message with a status of the server update.
- By specifying the parameter