PowerShell scripts to install and update a Valheim dedicated server in Windows.
- Open PowerShell as administrator.
- Create a location for the script and navigate to that directory.
mkdir C:\temp
CD C:\temp
- Download the script.
curl https://raw.githubusercontent.com/Jammrock/ValheimPS/main/Update-ValheimServer.ps1 -OutFile .\Update-ValheimServer.ps1
- [Optional] Make changes to the script. The top part of the script contains where things are installed, and various bits of info used to install and run the server.
- Execute the script with these parameters. A Steam account is not needed to install the dedicated server.
.\Update-ValheimServer.ps1 -Anonymous -Force -Verbose
If script execution is blocked you will need to change the script execution policy.
- All set!
- Installs SteamCMD.
- Uses SteamCMD to install the Valheim Dedicated Server.
- Creates a Scheduled Task that runs the server on startup.
- The task runs as LocalService.
- File and folder permissions to the Valheim install directory are granted to LocalService.
- Adds an allow rule in Windows Firewall for valheim_server.exe.
- Starts the server using these arguments:
-nographics -batchmode -name "My Valheim Server" -port '+$gameListenPort+' -world "Dedicated" -password "mySecret" -savedir '+$gamePath+'\save -public 0
- The server arguments can be adjusted using the
<$gameProcessArgs>
variable.
- Automatically run on a schedule to update the server files to a new version. This is something I'll address in the future. For now, run the same command to update the server files as needed.
- Open any permimeter firewall ports for cloud services like Azure, AWS, etc.
- Make you good at Valheim.