From c29a08919e983f0338d3d92980e1a73af2fbadb2 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 24 Mar 2024 14:46:31 +0100 Subject: [PATCH] Initialize variables before use --- profiles/DerGeret/Windows/Setup.ps1 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/profiles/DerGeret/Windows/Setup.ps1 b/profiles/DerGeret/Windows/Setup.ps1 index a2603873..a081fe19 100644 --- a/profiles/DerGeret/Windows/Setup.ps1 +++ b/profiles/DerGeret/Windows/Setup.ps1 @@ -9,6 +9,18 @@ function Initialize-SetupConfig() { ); $null = New-Module { + $setupComponent = $config.SelectSingleNode( + "/ua:unattend/ua:settings[@pass='windowsPE']/ua:component[@name='Microsoft-Windows-Setup']", + $namespace); + + $diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace); + + $partitionCreationContainer = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace); + $partitionCreations = $partitionCreationContainer.SelectNodes("./ua:CreatePartition", $namespace); + + $partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); + $partitionModifications = $partitionModificationContainer.SelectNodes("./ua:ModifyPartition", $namespace); + <# .SYNOPSIS Gets the XML element describing the installation partition ID. @@ -112,18 +124,6 @@ function Initialize-SetupConfig() { } } - $setupComponent = $config.SelectSingleNode( - "/ua:unattend/ua:settings[@pass='windowsPE']/ua:component[@name='Microsoft-Windows-Setup']", - $namespace); - - $diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace); - - $partitionCreationContainer = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace); - $partitionCreations = $partitionCreationContainer.SelectNodes("./ua:CreatePartition", $namespace); - - $partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); - $partitionModifications = $partitionModificationContainer.SelectNodes("./ua:ModifyPartition", $namespace); - # Resize EFI partition to 1GB $partitionCreations[1].SelectSingleNode("./ua:Size", $namespace).InnerText = "$(1024)";