diff --git a/profiles/DerGeret/Windows/Setup.ps1 b/profiles/DerGeret/Windows/Setup.ps1 index ae2bd35e..da2b980c 100644 --- a/profiles/DerGeret/Windows/Setup.ps1 +++ b/profiles/DerGeret/Windows/Setup.ps1 @@ -51,13 +51,13 @@ $Global:SetupConfigPostprocessor = { $newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex"; $null = $partitionCreationContainer.AppendChild($newPartition); - $partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); - $newModification = $partitionModifications.SelectNodes("./ua:ModifyPartition", $namespace)[2].CloneNode($true); + $partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); + $partitionModifications = $partitionModificationContainer.SelectNodes("./ModifyPartition", $namespace); + $newModification = $partitionModifications[1].CloneNode($true); $newModification.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex"; $newModification.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$newIndex"; - for ($i = 0; $i -lt $partitionModifications.ChildNodes.Count; $i++) { - $partition = $partitionModifications.ChildNodes[$i]; + foreach ($partition in $partitionModifications) { $partitionID = [int]$partition.SelectSingleNode("./ua:PartitionID", $namespace).InnerText; $newID = $partitionID; @@ -79,7 +79,7 @@ $Global:SetupConfigPostprocessor = { } } - $null = $partitionModifications.AppendChild($newModification); + $null = $partitionModificationContainer.AppendChild($newModification); } . "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";