Skip to content

hjorslev/SteamPS

Repository files navigation

SteamPS

GH Actions Codecov PS Gallery
GitHub Actions Workflow Status Codecov (with branch) PowerShell Gallery

Introduction

SteamPS is a PowerShell module that utilizes PowerShell as a wrapper for SteamCMD and interacts with various Steam APIs.

SteamPS is aimed at server administrators maintaining one or more servers. It can be used to install SteamCMD, update game servers, query Steam based game servers for server information and more.

Command Reference

Cmdlet Description
Connect-SteamAPI Create or update the Steam Web API config file.
Disconnect-SteamAPI Disconnects from the Steam API by removing the stored API key.
Get-SteamApp Retrieves the name and ID of a Steam application by searching the name or ID of the application.
Get-SteamFriendList Returns the friend list of any Steam user.
Get-SteamNews Returns the latest news of a game.
Get-SteamPlayerBan Returns Community, VAC, and Economy ban statuses for any given players.
Get-SteamPlayerSummary Returns basic profile information for a list of 64-bit Steam IDs.
Get-SteamServerInfo Query a running Steam based game server.
Install-SteamCMD Downloads and installs SteamCMD.
Resolve-VanityURL Resolve a vanity URL (also named custom URL).
Update-SteamApp Install or update a Steam application using SteamCMD.
Update-SteamServer Update a Steam based game server through a workflow.

Prerequisites

  • Windows based OS
  • Windows PowerShell 5.1 / PowerShell 7.

You can find your version of PowerShell by using:

$PSVersionTable.PSVersion

Getting Started

Install from PowerShell Gallery

The module is published in the PowerShell Gallery.

Run the following in an elevated prompt to install the module globally for all users on the server:

Install-Module -Name SteamPS

The module can also be installed in the current user's scope by adding -Scope CurrentUser to the above mentioned command. If multiple people are administrating the server, it can be easier to maintain the module by having SteamPS installed in just one location.

Furthermore, if you plan to have cmdlets from the module running unattended you will need to make sure that the module is available to the user running it. This can be achieved by ensuring the module is installed for the user running it, or just have it installed globally for all users as exemplified above.

When SteamPS is installed you will need to use the cmdlet Install-SteamCMD from the module to install SteamCMD. This is done by calling Install-SteamCMD from an elevated prompt:

Install-SteamCMD

Select application

By using the parameter -InstallPath you can specify an install location of SteamCMD. The default installation path is C:\Program Files\SteamCMD. The install path, default or custom, is added to the PATH.

Usage

Update single app / game server

The cmdlet Update-SteamApp is used to both install and/or update an application. You can either specify the name of the application or the application ID.

Install / Update using ApplicationName

If you enter e.g. Ground Branch as an application name you will see both the game itself as well as the dedicated server. You will have to select the correct application from the popup box.

Update-SteamApp -ApplicationName 'Ground Branch' -Path 'C:\DedicatedServers\GB'

Select application

You can narrow down the search by typing an application name that is more specific than simply Ground Branch e.g. Ground Branch Dedi or type it out in its entirety as Ground Branch Dedicated Server. This will only give one result and not display a popup.

Update-SteamApp -ApplicationName 'Ground Branch Dedicated Server' -Path 'C:\DedicatedServers\GB'

Select application

Install / Update using AppID

In this example we install ARK: SurvivalEvolved Dedicated Server by using its AppID. The AppID can be found by using a database such as Steam Database or by searching for the AppID with the cmdlet Get-SteamApp e.g. Get-SteamApp -ApplicationName 'Counter-Strike'.

Update-SteamApp -AppID 376030 -Path 'C:\DedicatedServers\ARK-SurvivalEvolved'

Authenticating

The two previous examples do not require authentication to install. However, some applications might require a Steam account. If that is the case, you will need to use the parameter -Credential to authenticate:

Update-SteamApp -ApplicationName 'Ground Branch Dedicated Server' -Path 'C:\DedicatedServers\GB' -Credential SAS_Admin

This will present you with an option to type in your password.

In case you need to authenticate and want to run the script unattended, avoid writing the password in plaintext in the script. See how this can be achieved: Store Credentials in PowerShell Script.

Update Steam server automatically

The cmdlet Update-SteamServer is, at least for my own use case, applied to automatically keep a server up to date. It will check if the server is empty before updating it. The script is configured as a Windows Task and runs very night.

Please see the wiki for further information: Update Steam server automatically.

Acknowledgements

Joystick icon by Delapouite. Available at game-icons.net.