mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-18 00:20:09 +02:00
Updated the manuals
This commit is contained in:
47
docs/reboot-into-bios.md
Normal file
47
docs/reboot-into-bios.md
Normal file
@@ -0,0 +1,47 @@
|
||||
The *reboot-into-bios.ps1* Script
|
||||
===========================
|
||||
|
||||
reboot-into-bios.ps1
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
# Requires admin privileges to run
|
||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Host "This script requires administrative privileges." -ForegroundColor Red
|
||||
Write-Host "Please run PowerShell as Administrator and try again." -ForegroundColor Yellow
|
||||
pause
|
||||
exit 1
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Host "Preparing to reboot into BIOS/UEFI..." -foregroundColor Yellow
|
||||
|
||||
# Get boot configuration
|
||||
$bootConfig = bcdedit /enum firmware
|
||||
if ($lastExitCode -ne 0) { throw "Failed to get boot configuration" }
|
||||
|
||||
# Set the one-time boot to UEFI
|
||||
$result = shutdown /r /fw /t 0
|
||||
if ($lastExitCode -ne 0) { throw "Failed to initiate reboot" }
|
||||
|
||||
} catch {
|
||||
Write-Host "Error: $_" -ForegroundColor Red
|
||||
Write-Host "Failed to initiate BIOS reboot." -ForegroundColor Red
|
||||
pause
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:58)*
|
Reference in New Issue
Block a user