fix(welcome): eject optical install media before BitLocker enroll (it refuses TPM+PIN with bootable media present — found in live e2e)
All checks were successful
Build SilverMetal Enhanced - Windows ISO / build (pull_request) Successful in 4m35s
All checks were successful
Build SilverMetal Enhanced - Windows ISO / build (pull_request) Successful in 4m35s
This commit is contained in:
@@ -14,6 +14,11 @@ public sealed class BitLockerService(IProcessRunner runner) : IBitLockerService
|
||||
// 3. Remove any TPM-only protector (only once a TPM+PIN protector is confirmed present)
|
||||
// so the device actually requires the PIN at pre-boot.
|
||||
var script = string.Concat(
|
||||
// Eject optical install media first — BitLocker -TpmAndPinProtector refuses to enroll
|
||||
// while bootable CD/DVD media is present ("detected bootable media in the computer").
|
||||
"try { $s=New-Object -ComObject Shell.Application; ",
|
||||
"$s.Namespace(17).Items() | Where-Object { $_.Type -match 'CD|DVD' } | ForEach-Object { try { $_.InvokeVerb('Eject') } catch {} } } catch {}; ",
|
||||
"Start-Sleep -Seconds 3; ",
|
||||
"$fve='HKLM:\\SOFTWARE\\Policies\\Microsoft\\FVE'; ",
|
||||
"New-Item -Path $fve -Force | Out-Null; ",
|
||||
"New-ItemProperty -Path $fve -Name UseAdvancedStartup -Value 1 -PropertyType DWord -Force | Out-Null; ",
|
||||
|
||||
@@ -81,6 +81,9 @@ public class ApplyServicesTests
|
||||
// Removes any TPM-only protector so the device requires the PIN at pre-boot.
|
||||
run.Verify(r => r.RunAsync("powershell.exe", It.Is<string>(s =>
|
||||
s.Contains("Remove-BitLockerKeyProtector")), It.IsAny<CancellationToken>()));
|
||||
// Ejects optical install media first (BitLocker refuses to enroll with bootable media present).
|
||||
run.Verify(r => r.RunAsync("powershell.exe", It.Is<string>(s =>
|
||||
s.Contains("Shell.Application") && s.Contains("Eject")), It.IsAny<CancellationToken>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user