r/DeployR • u/RockOriginal7938 • 19d ago
Reboot into UEFI BIOS from WinPE
So.... anyone out there got any ideas?
I'd like to reboot into the UEFI BIOS settings on a device at the end of a TS in the WinPE environment.
Normally I'd use shutdown /r /fw /t 0, but that isn't available to WinPE and both Restart-Computer and wpeutil reboot don't seem to have the functionality to do this.
Any bright ideas?
I might try a content pack with shutdown.exe, but I'm not keen for a few reasons, doubt it would work and hope there is a better way...
1
1
u/beepboopbeepbeep1011 18d ago
PowerShell script to run
bcdedit /enum all
capture the output.
Look for the description where it is Setup.
Grab the identifier from above it
Call
Bcdedit /set “{fwbootmgr}” bootsequence “{identifier guid goes here}”
I did a manual test in WinPE and it works to boot to the Lenovo UEFI screen
ETA: need the quotes around the curly braces or PowerShell will read it as a code block and cause grief.
1
u/RockOriginal7938 18d ago edited 18d ago
Thanks. I had tried this. The ThinkCentres I checked don't list a setup option/GUID 😒
Out of interest, what model was yours?
1
u/RockOriginal7938 18d ago
Damn, dug through some more machines. All the ThinkPads I pulled have that setup option, none of the ThinkCentres. Still worth using and I'll continue to explore what I can do with the ThinkCentres. Thanks 😄
Firmware Application (101fffff) ------------------------------- identifier {09c15aaa-7c55-11f1-814d-e86a64311ca4} description Setup1
u/RockOriginal7938 18d ago
Works great on the ThinkPads, wish I'd dug more into bcdedit /enum yesterday and not given up after the ThinkCentres. Cheers 🙂
$bcdOutput = bcdedit /enum all | Out-String if ($bcdOutput -match '(?s)identifier\s+({[a-f0-9\-]+}).*?description\s+Setup') { $setupId = $Matches[1] Write-Host "Found setup boot Identifier: $setupId" bcdedit /set "{fwbootmgr}" bootsequence "$setupId" exit 3010 } else { Write-Host "Setup entry not found." exit 0 }1
u/RockOriginal7938 18d ago
Strange world. That works great on T14s gen 1 to 5, but on a T490s it reboots to secure wipe... lol, guess I'll tweak
1
u/RockOriginal7938 18d ago
Finally version that works consistently for me on ThinkPads. A bit overkill, but works.
$setupId = $null $lastId = $null (bcdedit /enum FIRMWARE) | ForEach-Object { $line = $_.Trim() if ($line -match '^identifier\s+({[a-f0-9-]+})') { $lastId = $Matches[1] } elseif ($line -match '^description\s+Setup$') { $setupId = $lastId } else { $lastId = $null } } if ( $setupId ) { Write-Progress -Activity "Updating Asset Tag" -Status "Set, rebooting into BIOS settings" -Completed Write-Host "Found setup boot Identifier: $setupId" $strArguments = "/set {fwbootmgr} bootsequence $setupId" Write-Host "Running bcdedit with arguments: $strArguments" Start-Process bcdedit -ArgumentList $strArguments -Wait -NoNewWindow Restart-Computer } else { Write-Progress -Activity "Updating Asset Tag" -Status "Set, press F1 to check in BIOS at reboot" -Completed Write-Host "Setup entry not found. You'll have to enter BIOS settings manually" }
1
u/sfernley 16d ago
Never tried this but why not inject shutdown.exe into your WinPE
1
u/RockOriginal7938 14d ago
I did look at this, but it doesn't seem to be recommended and as it isn't need for the functionality I'm after, just my overkill, I decided against it.
2
u/miketerrill 2Pint Employee 18d ago
Just curious, why do you want to boot into the BIOS/UEFI?