From cb1a0a8e4b81406b50039c0661c3ad1c47b9817d Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Mon, 3 Jul 2023 12:59:55 +0200
Subject: [PATCH] Ensure proper XML elements are evaluated

---
 profiles/DerGeret/Windows/Setup.ps1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/DerGeret/Windows/Setup.ps1 b/profiles/DerGeret/Windows/Setup.ps1
index bb1388ed..78724bee 100644
--- a/profiles/DerGeret/Windows/Setup.ps1
+++ b/profiles/DerGeret/Windows/Setup.ps1
@@ -14,7 +14,7 @@ $Global:SetupConfigPostprocessor = {
     $newIndex = [int]$installationPartition.InnerText;
     $installationPartition.InnerText = "$($newIndex + 1)";
     $partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace);
-    $newPartition = $partitionCreations.FirstChild.CloneNode($true);
+    $newPartition = $partitionCreations.SelectNodes("./ua:CreatePartition", $namespace)[0].CloneNode($true);
     $newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
     $newPartition.SelectSingleNode("./ua:Size", $namespace).InnerText = "65536"; # For testing purposes
 
@@ -30,7 +30,7 @@ $Global:SetupConfigPostprocessor = {
     $partitionCreations.AppendChild($newPartition);
 
     $partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);
-    $newModification = $diskConfig.ChildNodes[2].CloneNode($true);
+    $newModification = $diskConfig.SelectNodes("./ua:ModifyPartition", $namespace)[2].CloneNode($true);
     $newModification.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
     $newModification.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$newIndex";