fix(windows/build): launch legacy Setup with explicit /unattend
All checks were successful
Build SilverMetal Enhanced - Windows ISO / build (push) Successful in 4m47s
All checks were successful
Build SilverMetal Enhanced - Windows ISO / build (push) Successful in 4m47s
Legacy Setup (forced via boot.wim CmdLine) still showed the language page because implicit answer-file search is unreliable when setup is launched via CmdLine. Inject autounattend.xml into boot.wim (X:\autounattend.xml) and set CmdLine to "X:\sources\setup.exe /unattend:X:\autounattend.xml" so all passes are consumed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -96,14 +96,18 @@ function Invoke-ForceLegacySetup {
|
||||
if (-not (Test-Path $bootwim)) { throw "boot.wim not found: $bootwim" }
|
||||
Mount-WindowsImage -ImagePath $bootwim -Index 2 -Path $bootmnt | Out-Null
|
||||
try {
|
||||
$cmdline = 'X:\sources\setup.exe'
|
||||
if (-not (Test-Path (Join-Path $bootmnt 'sources\setup.exe')) -and
|
||||
(Test-Path (Join-Path $bootmnt 'setup.exe'))) { $cmdline = 'X:\setup.exe' }
|
||||
# Inject the answer file into the WinPE image at a fixed X: path, and launch
|
||||
# legacy setup with an EXPLICIT /unattend -- the implicit media search is
|
||||
# unreliable when setup is launched via the CmdLine override (legacy Setup
|
||||
# otherwise still shows the language page).
|
||||
Copy-Item (Join-Path $PSScriptRoot 'autounattend\autounattend.xml') (Join-Path $bootmnt 'autounattend.xml') -Force
|
||||
$setup = if (Test-Path (Join-Path $bootmnt 'sources\setup.exe')) { 'X:\sources\setup.exe' } else { 'X:\setup.exe' }
|
||||
$cmdline = "$setup /unattend:X:\autounattend.xml"
|
||||
$hive = Join-Path $bootmnt 'Windows\System32\config\SYSTEM'
|
||||
& reg load 'HKLM\SM_BOOT' $hive | Out-Null
|
||||
try {
|
||||
& reg add 'HKLM\SM_BOOT\Setup' /v CmdLine /t REG_SZ /d $cmdline /f | Out-Null
|
||||
Write-Host " WinPE Setup\CmdLine = $cmdline (legacy Setup forced)"
|
||||
Write-Host " WinPE Setup\CmdLine = $cmdline (legacy Setup + explicit unattend)"
|
||||
} finally {
|
||||
[gc]::Collect(); Start-Sleep -Seconds 2
|
||||
& reg unload 'HKLM\SM_BOOT' | Out-Null
|
||||
|
||||
Reference in New Issue
Block a user