Refactor the format of the Autounattend.xml
file
This commit is contained in:
parent
0ba664eb51
commit
ebcac5536d
1 changed files with 8 additions and 1 deletions
|
@ -4,7 +4,14 @@ $null = $env:SETUP_SCRIPT_NAME;
|
|||
# Find `winiso` installation medium
|
||||
$drives = & wmic volume get "DriveLetter,Label";
|
||||
$drive = $($($drives | Select-String -Pattern "winiso") -split "\s+")[0];
|
||||
[xml]$unattendedConfig = $(Get-Content "$drive\Autounattend.template.xml");
|
||||
[xml]$unattendedConfig = [xml]::new();
|
||||
$unattendedConfig.PreserveWhitespace = $true;
|
||||
|
||||
$readerSettings = [System.Xml.XmlReaderSettings]::new();
|
||||
$readerSettings.IgnoreComments = $true;
|
||||
$reader = [System.Xml.XmlReader]::Create("$drive\Autounattend.template.xml", $readerSettings);
|
||||
|
||||
$unattendedConfig.Load($reader);
|
||||
$namespace = New-Object -TypeName "Xml.XmlNamespaceManager" -ArgumentList $unattendedConfig.NameTable;
|
||||
$namespace.AddNamespace("ua", $unattendedConfig.DocumentElement.NamespaceURI);
|
||||
|
||||
|
|
Loading…
Reference in a new issue