From d84c30759308aadf550f0d80b1daecc13733e29d Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:30:12 -0700 Subject: [PATCH] Ensure capture media exists for app installation Forces the creation of capture media if app installation is enabled and the capture ISO does not already exist. This change prevents a failure later in the build process by ensuring the necessary media is available. --- FFUDevelopment/BuildFFUVM.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 0f94a02..a9dfa38 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -3771,6 +3771,20 @@ if ($CopyUnattend) { WriteLog 'Unattend validation complete' } +# If InstallApps is true, we need capture media. +if ($InstallApps) { + if (-not $CreateCaptureMedia) { + if (-not (Test-Path -Path $CaptureISO)) { + WriteLog "InstallApps is true, but CreateCaptureMedia is false and the capture ISO does not exist at $CaptureISO." + WriteLog "Forcing CreateCaptureMedia to true to build the required capture media." + $CreateCaptureMedia = $true + } + else { + WriteLog "InstallApps is true. Using existing capture media found at $CaptureISO." + } + } +} + #Override $InstallApps value if using ESD to build FFU. This is due to a strange issue where building the FFU #from vhdx doesn't work (you get an older style OOBE screen and get stuck in an OOBE reboot loop when hitting next). #This behavior doesn't happen with WIM files.