From 17b2ec2be74513102b113f1fb56d9804cc422d0c Mon Sep 17 00:00:00 2001 From: sysadmin Date: Mon, 8 Jun 2026 23:31:37 +0100 Subject: [PATCH] fix(windows/build): launch legacy Setup with explicit /unattend 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 --- windows/installer/build.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/windows/installer/build.ps1 b/windows/installer/build.ps1 index 7a6e78d..6208a27 100644 --- a/windows/installer/build.ps1 +++ b/windows/installer/build.ps1 @@ -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