Install windows to the last partition

This commit is contained in:
Manuel Thalmann 2023-07-03 12:40:28 +02:00
parent 12500b1993
commit afa570e498

View file

@ -5,11 +5,15 @@ $env:SETUP_SCRIPT_NAME = [System.IO.Path]::GetRelativePath("$PSScriptRoot/../../
$Global:SetupConfigPostprocessor = {
param([xml] $config, [System.Xml.XmlNamespaceManager] $namespace)
$diskConfig = $config.SelectSingleNode(
"/ua:unattend/ua:settings[@pass='windowsPE']/ua:component[@name='Microsoft-Windows-Setup']/ua:DiskConfiguration/ua:Disk",
$setupComponent = $config.SelectSingleNode(
"/ua:unattend/ua:settings[@pass='windowsPE']/ua:component[@name='Microsoft-Windows-Setup']",
$namespace);
$newIndex = 4;
$diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace);
$installationPartition = $setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID");
$newIndex = [int]$installationPartition.InnerText;
$installationPartition.InnerText = "$($newIndex + 1)";
$partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions");
$newPartition = $partitionCreations.FirstChild.CloneNode($true);
$newPartition.SelectSingleNode("./ua:Order").InnerText = "$newIndex";