From 44fd2d92ff83ae66cc0b98fbdaea0425add8fe03 Mon Sep 17 00:00:00 2001 From: mpanduru Date: Wed, 16 Sep 2026 11:36:48 +0300 Subject: [PATCH] Ensure the EFI boot directory exists before running BCDBoot --- WinImageBuilder.psm1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WinImageBuilder.psm1 b/WinImageBuilder.psm1 index 5b0d576..4045aa7 100755 --- a/WinImageBuilder.psm1 +++ b/WinImageBuilder.psm1 @@ -271,6 +271,12 @@ function Create-BCDBootConfig { $bcdbootPath = $bcdbootLocalPath } + if ($diskLayout -eq "UEFI") { + # on newer WS 2025 builds BCDBoot copies the boot manager before creating its destination. + New-Item -Path "${systemDrive}\EFI\Microsoft\Boot" -ItemType Directory ` + -Force -ErrorAction Stop | Out-Null + } + $ErrorActionPreference = "SilentlyContinue" # Note: older versions of bcdboot.exe don't have a /f argument if ($image.ImageVersion.Major -eq 6 -and $image.ImageVersion.Minor -lt 2) {