Skip to content

Instantly share code, notes, and snippets.

@MarcelMeurer
Created March 24, 2026 16:32
Show Gist options
  • Select an option

  • Save MarcelMeurer/01db5590b2af52cc630c7bd29befaf63 to your computer and use it in GitHub Desktop.

Select an option

Save MarcelMeurer/01db5590b2af52cc630c7bd29befaf63 to your computer and use it in GitHub Desktop.
Verify and install the UEFI Boot Certificates if needed
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing"
$valueName = "UEFICA2023Status"
try {
$value = (Get-ItemProperty -Path $regPath -Name $valueName -ErrorAction Stop).$valueName
Write-Output "The value of the UEFICA2023 state is: $value"
} catch {
Write-Output "Failed to read registry value"
exit 1
}
if ($value -eq "Updated") {
Write-Output "Nothing to do"
exit 0
}
try {
& "WinCsFlags.exe" /apply --key "F33E0C8E002"
} catch {
Write-Output "Error running WinCsFlags.exe"
}
try {
Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"
} catch {
Write-Output "Error starting scheduled task"
}
do {
Start-Sleep -Seconds 5
try {
$value = (Get-ItemProperty -Path $regPath -Name $valueName -ErrorAction Stop).$valueName
} catch {
Write-Output "Error reading registry value during loop"
exit 1
}
} while ($value -ne "Updated")
Write-Output "The value of the UEFICA2023 state is: $value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment