From 62ddc0c59bd4bc611c485e754997b8444263aa76 Mon Sep 17 00:00:00 2001 From: Patrick Veilleux Date: Fri, 3 Nov 2023 09:06:42 -0400 Subject: [PATCH] fix empty password issue --- functions/util/Optimize-ArgumentList.psm1 | 2 +- templates/ark_survival_ascended.psm1 | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/functions/util/Optimize-ArgumentList.psm1 b/functions/util/Optimize-ArgumentList.psm1 index e7ea450..6e6256c 100644 --- a/functions/util/Optimize-ArgumentList.psm1 +++ b/functions/util/Optimize-ArgumentList.psm1 @@ -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) } } diff --git a/templates/ark_survival_ascended.psm1 b/templates/ark_survival_ascended.psm1 index 7437e5b..94931f1 100644 --- a/templates/ark_survival_ascended.psm1 +++ b/templates/ark_survival_ascended.psm1 @@ -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 @@ -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" @@ -52,7 +52,7 @@ $ServerDetails = @{ #Rcon Port ManagementPort = 27020 - #Rcon / Admin Password *NO SPACES* + #Rcon / Admin Password *NO SPACES or Question Mark* ManagementPassword = "CHANGEME2" #--------------------------------------------------------- @@ -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) {