Skip to content

Commit 4a41923

Browse files
authored
Retry with local bcdboot.exe not only for old versions of bcdboot.exe (#406)
* Retry with local bcdboot.exe for new Windows versions (version >= 6.2).
1 parent 8beab9a commit 4a41923

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

WinImageBuilder.psm1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,16 @@ function Create-BCDBootConfig {
282282
}
283283
} else {
284284
$bcdbootOutput = & $bcdbootPath ${windowsDrive}\windows /s ${systemDrive} /v /f $diskLayout
285+
# Retry using the local bcdboot path
286+
if ($LASTEXITCODE) {
287+
Write-Log "Retrying with bcdboot.exe from host"
288+
$bcdbootOutput = & $bcdbootLocalPath ${windowsDrive}\windows /s ${systemDrive} /v /f $diskLayout
289+
}
285290
}
286291
if ($LASTEXITCODE) {
287292
$ErrorActionPreference = "Stop"
288293
throw "BCDBoot failed with error: $bcdbootOutput"
289294
}
290-
291295
Reset-BCDSearchOrder -systemDrive $systemDrive -windowsDrive $windowsDrive `
292296
-diskLayout $diskLayout
293297

0 commit comments

Comments
 (0)