Skip to content

Commit

Permalink
fix empty password issue
Browse files Browse the repository at this point in the history
  • Loading branch information
patrix87 committed Nov 3, 2023
1 parent e6317e3 commit 62ddc0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion functions/util/Optimize-ArgumentList.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Optimize-ArgumentList {
[System.Collections.ArrayList]$CleanedArguments = @()

foreach ($Argument in $Arguments) {
if (-not ($Argument.EndsWith('=""') -or $Argument.EndsWith('=') -or $Argument.EndsWith(' ') -or $Argument.EndsWith('="" ') )) {
if (-not ($Argument.EndsWith('=""') -or $Argument.EndsWith('=') -or $Argument.EndsWith(' ') -or $Argument.EndsWith('="" ') -or $Argument.EndsWith('="""') -or $Argument.EndsWith('=""""') -or $Argument.EndsWith('="""""') -or $Argument.EndsWith('=""""""'))) {
$null = $CleanedArguments.Add($Argument)
}
}
Expand Down
19 changes: 11 additions & 8 deletions templates/ark_survival_ascended.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ $ServerDetails = @{
#Login username used by SteamCMD
Login = "anonymous"

#Name of the server in the Server Browser
#Name of the server in the Server Browser *No Question Mark*
SessionName = "PowerShellGSM Ark Ascended Server"

#Maximum Number of Players
MaxPlayers = 64

#Password to join the server *NO SPACES*
#Password to join the server *NO SPACES or Question Mark*
Password = "CHANGEME"

#Server Port
Expand All @@ -25,7 +25,7 @@ $ServerDetails = @{
#Query Port
QueryPort = 27015

#World Name *NO SPACES*
#World Name *NO SPACES or Question Mark*
WorldName = "TheIsland_WP"

#Enable PVE "True" or "False"
Expand All @@ -52,7 +52,7 @@ $ServerDetails = @{
#Rcon Port
ManagementPort = 27020

#Rcon / Admin Password *NO SPACES*
#Rcon / Admin Password *NO SPACES or Question Mark*
ManagementPassword = "CHANGEME2"

#---------------------------------------------------------
Expand Down Expand Up @@ -200,21 +200,24 @@ $Warnings = New-Object -TypeName PsObject -Property $WarningsDetails
$ArgumentList = @(
"$($Server.WorldName)",
"?listen",
"?SessionName=`"`"`"$($Server.SessionName)`"`"`"", #Triple double-quotes here. (normal for now)
"?SessionName=`"`"`"$($Server.SessionName)`"`"`"", #Triple double-quotes here.
"?ServerPassword=`"`"$($Server.Password)`"`"",
"?Port=$($Server.Port)",
"?QueryPort=$($Server.QueryPort)",
"?RCONEnabled=$($Server.EnableRcon)",
"?RCONPort=$($Server.ManagementPort)",
"?ServerPVE=$($Server.ServerPVE)",
"?MaxPlayers=$($Server.MaxPlayers)",
"?ServerPassword=`"`"$($Server.Password)`"`"", #No triple quotes here. (normal for now)
"?ServerAdminPassword=`"`"`"$($Server.ManagementPassword)`"`"`"" #Triple double-quotes here. Leave at the end for some reasons. (normal for now)
"?MaxPlayers=$($Server.MaxPlayers)"
)

if ($Server.SaveFolder) {
$ArgumentList += "?AltSaveDirectoryName=$($Server.SaveFolder)"
}

if ($Server.ManagementPassword) {
$ArgumentList += "?ServerAdminPassword=`"`"$($Server.ManagementPassword)`"`"" #Fix Server Admin Password Issues.
}

$ArgumentList += " -WinLiveMaxPlayers=$($Server.MaxPlayers)" #Fix MaxPlayers not working.

if ($Server.Mods) {
Expand Down

0 comments on commit 62ddc0c

Please sign in to comment.