diff --git a/profiles/DerGeret/Windows/Setup.ps1 b/profiles/DerGeret/Windows/Setup.ps1 index 7b8f01e9..d0015fff 100644 --- a/profiles/DerGeret/Windows/Setup.ps1 +++ b/profiles/DerGeret/Windows/Setup.ps1 @@ -9,6 +9,14 @@ function Initialize-SetupConfig() { ); New-Module { + <# + .SYNOPSIS + Gets the XML element describing the installation partition ID. + #> + Get-InstallationPartition { + $setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID", $namespace) + } + <# .SYNOPSIS Increases the ID of all partitions in the specified range by 1. @@ -19,13 +27,16 @@ function Initialize-SetupConfig() { [System.Nullable[int]]$To = $null, [int]$By = 1 ) - + + # Update installation partition ID if necessary + $installationPartition = Get-InstallationPartition; $installPartitionID = [int]$installationPartition.InnerText; if (($installPartitionID -ge $From) -and (($null -eq $To) -or ($installPartitionID -lt $To))) { $installationPartition.InnerText = "$($installPartitionID + $By)"; } + # Update IDs of all partition creations foreach ($partition in $partitionCreations) { $orderNode = $partition.SelectSingleNode("./ua:Order", $namespace); $order = [int]$orderNode.InnerText; @@ -40,6 +51,7 @@ function Initialize-SetupConfig() { } } + # Update IDs of all partition modifications foreach ($partition in $partitionModifications) { $partitionNode = $partition.SelectSingleNode("./ua:PartitionID", $namespace); $partitionID = [int]$partitionNode.InnerText; @@ -105,7 +117,6 @@ function Initialize-SetupConfig() { $namespace); $diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace); - $installationPartition = $setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID", $namespace); $partitionCreationContainer = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace); $partitionCreations = $partitionCreationContainer.SelectNodes("./ua:CreatePartition", $namespace);