Fix script for altering windows partitions

This commit is contained in:
Manuel Thalmann 2023-07-08 23:48:27 +02:00
parent 3eba9696d6
commit 5da43e3f48

View file

@ -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);