Created
February 5, 2021 19:57
-
-
Save TBSliver/3a093e9e7fb31d7f63cc172f06296707 to your computer and use it in GitHub Desktop.
Valheim Server Scripts (Windows Server)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Will need to be run as an administrator | |
$rule_name = "Valheim Server 1" | |
# Change ports as needed | |
$tcp_ports = "2456,2457,2458" | |
# Change ports as needed | |
$udp_ports = "2456,2457,2458" | |
netsh advfirewall firewall add rule name="${rule_name}: TCP" dir=in protocol=tcp localport=$tcp_ports action=allow | |
netsh advfirewall firewall add rule name="${rule_name}: UDP" dir=in protocol=udp localport=$udp_ports action=allow | |
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete lines below as needed for password/no password servers | |
# Change server name as needed | |
$server_name = "My Valheim Server" | |
# Change world as needed | |
$world_name = "World" | |
# If not using password, delete this line | |
$password = "Password" | |
# Change port as needed | |
$server_port = "2456" | |
# Past here are dragons! (not really) | |
$server_full_name = "${server_name}: ${world_name}" | |
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition | |
cd "$scriptPath\valheim-server" | |
# If not using password, delete this line | |
Start-Process -FilePath ".\valheim_server.exe" -ArgumentList "-nographics -batchmode -name ""$server_full_name"" -port $server_port -world ""$world_name"" -password ""$password"" -public 1" | |
# If using password, delete this line | |
Start-Process -FilePath ".\valheim_server.exe" -ArgumentList "-nographics -batchmode -name ""$server_full_name"" -port $server_port -world ""$world_name"" -public 1" | |
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$app_path = "$pwd\valheim-server" | |
if(!(Test-Path $app_path)) | |
{ | |
mkdir $app_path | |
} | |
steamcmd +login anonymous +force_install_dir "$app_path" +app_update 896660 validate +exit | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
Used the PS Script to Open Ports, but my Server is not visible in the server browser. Direct connect does work on port 2457.