#Requires -RunAsAdministrator [CmdletBinding()] param() $ErrorActionPreference = 'Stop' $logPath = Join-Path $PSScriptRoot 'enable-test-mode.log' $secureBoot = $null try { $secureBoot = Confirm-SecureBootUEFI } catch { Write-Verbose "Unable to read Secure Boot state: $($_.Exception.Message)" } $bcdOutput = & bcdedit.exe /set testsigning on 2>&1 $bcdOutput | Out-File -LiteralPath $logPath -Encoding utf8 -Force if ($LASTEXITCODE -ne 0) { if ($secureBoot -eq $true) { throw 'Secure Boot blocks test-signing mode. Disable it in UEFI before trying again.' } throw "Unable to enable test-signing mode ($LASTEXITCODE)." } Write-Host 'Test-signing mode is enabled in the BCD.' Write-Host 'Restart Windows before loading QemuA6Ude.sys.' Add-Content -LiteralPath $logPath -Encoding utf8 -Value @( 'Test-signing mode is enabled in the BCD.', 'A Windows restart is required.' )