diff --git a/scripts/Windows/OS/Setup.ps1 b/scripts/Windows/OS/Setup.ps1 index 9cdd26fee..b9220218c 100644 --- a/scripts/Windows/OS/Setup.ps1 +++ b/scripts/Windows/OS/Setup.ps1 @@ -1,6 +1,9 @@ $null = $env:WIN_COMPUTER_NAME; $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"); function Get-PassSettings { @@ -12,9 +15,6 @@ function Get-PassSettings { return $unattendedConfig.SelectSingleNode("/unattend/settings[@pass='$passName']"); } -$drives = & wmic volume get "DriveLetter,Label"; -$drive = $($($drives | Select-String -Pattern "winiso") -split "\s+")[0]; - # Adjust unattended settings $specializeSettings = Get-PassSettings "specialize"; $specializeSettings.SelectSingleNode("./component[@name='Microsoft-Windows-Shell-Setup']/ComputerName").InnerText = "$env:WIN_COMPUTER_NAME";