diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index d3b89e9b..0efe17bd 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -285,22 +285,24 @@ class Context { $( for ($i = 0; $i -lt $oldContent.Count; $i++) { - if ($_ -eq "[Accounts]") { + $line = $oldContent[$i]; + + if ($line -eq "[Accounts]") { $accountSectionEntered = $true; } if ( - ($_ -eq "" -and $accountSectionEntered) -or + ($line -eq "" -and $accountSectionEntered) -or ( (-not $accountSectionLeft) -and - ($_ -ne "") -and + ($line -ne "") -and ($i -eq ($oldContent.Count - 1)) )) { $accountSectionLeft = $true; $newSettings; } - $_; + $line; }) | Set-Content ($this.GetNextcloudConfigFile()); Write-Information "New nextcloud config:";