diff --git a/profiles/DerGeret/Windows/Setup.ps1 b/profiles/DerGeret/Windows/Setup.ps1 index 03951c55f..dba38e387 100644 --- a/profiles/DerGeret/Windows/Setup.ps1 +++ b/profiles/DerGeret/Windows/Setup.ps1 @@ -13,14 +13,14 @@ $Global:SetupConfigPostprocessor = { $newIndex = 2; $installationPartition.InnerText = "$($newIndex + 1)"; - $partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace); - $winPartition = ($partitionCreations.SelectNodes("./ua:CreatePartition", $namespace) | Select-Object -Last 1); + $partitionCreationContainer = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace); + $partitionCreations = $partitionCreationContainer.SelectNodes("./ua:CreatePartition", $namespace); + $winPartition = ($partitionCreations | Select-Object -Last 1); $newPartition = $winPartition.CloneNode($true); $offset = 0; - for ($i = 0; $i -lt $partitionCreations.ChildNodes.Count; $i++) { - $partition = $partitionCreations.ChildNodes[$i]; + foreach ($partition in $partitionCreations) { $order = [int]$partition.SelectSingleNode("./ua:Order", $namespace).InnerText; $offset += [int]$partition.SelectSingleNode("./ua:Size", $namespace).InnerText; $newOrder = $order; @@ -49,7 +49,7 @@ $Global:SetupConfigPostprocessor = { $winPartition.AppendChild($size); $newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex"; - $null = $partitionCreations.AppendChild($newPartition); + $null = $partitionCreationContainer.AppendChild($newPartition); $partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); $newModification = $partitionModifications.SelectNodes("./ua:ModifyPartition", $namespace)[2].CloneNode($true);