2024-10-01 15:11:03 +02:00
|
|
|
|
<#
|
2022-11-14 13:33:53 +01:00
|
|
|
|
.SYNOPSIS
|
2023-04-11 10:48:59 +02:00
|
|
|
|
Checks the BIOS status
|
2022-11-14 13:33:53 +01:00
|
|
|
|
.DESCRIPTION
|
2023-01-23 14:04:23 +01:00
|
|
|
|
This PowerShell script queries the BIOS status and prints it.
|
2022-11-14 13:33:53 +01:00
|
|
|
|
.EXAMPLE
|
2023-08-06 21:35:36 +02:00
|
|
|
|
PS> ./check-bios.ps1
|
2024-10-10 20:41:36 +02:00
|
|
|
|
✅ BIOS model P62 v02.67, version HPQOEM - 5, S/N CZC1080B01 by HP
|
2022-11-14 13:33:53 +01:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
|
.NOTES
|
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if ($IsLinux) {
|
2023-08-21 17:06:42 +02:00
|
|
|
|
$model = (sudo dmidecode -s system-product-name)
|
2024-10-16 14:48:06 +02:00
|
|
|
|
if ("$model" -eq "") { exit 0 } # no information
|
|
|
|
|
Write-Progress "Querying BIOS details..."
|
|
|
|
|
$version = (sudo dmidecode -s bios-version)
|
|
|
|
|
$releaseDate = (sudo dmidecode -s bios-release-date)
|
|
|
|
|
$manufacturer = (sudo dmidecode -s system-manufacturer)
|
2024-10-16 10:45:42 +02:00
|
|
|
|
Write-Progress -completed "Done."
|
2022-11-14 13:33:53 +01:00
|
|
|
|
} else {
|
2024-10-16 10:45:42 +02:00
|
|
|
|
$details = Get-CimInstance -ClassName Win32_BIOS
|
|
|
|
|
$model = $details.Name.Trim()
|
|
|
|
|
$version = $details.Version.Trim()
|
|
|
|
|
$serial = $details.SerialNumber.Trim()
|
|
|
|
|
$manufacturer = $details.Manufacturer.Trim()
|
2022-11-14 13:33:53 +01:00
|
|
|
|
}
|
2024-10-16 10:45:42 +02:00
|
|
|
|
if ($model -eq "To be filled by O.E.M.") { $model = "N/A" }
|
|
|
|
|
if ($version -eq "To be filled by O.E.M.") { $version = "N/A" }
|
2024-10-16 10:52:10 +02:00
|
|
|
|
if ("$releaseDate" -ne "") { $releaseDate = " of $releaseDate" }
|
2024-10-16 10:45:42 +02:00
|
|
|
|
if ("$serial" -eq "") { $serial = "N/A" }
|
|
|
|
|
if ($serial -eq "To be filled by O.E.M.") { $serial = "N/A" }
|
|
|
|
|
Write-Host "✅ BIOS model $model, version $($version)$($releaseDate), S/N $serial by $manufacturer"
|
2022-11-14 13:33:53 +01:00
|
|
|
|
exit 0 # success
|
|
|
|
|
} catch {
|
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
|
|
|
exit 1
|
2023-08-06 21:35:36 +02:00
|
|
|
|
}
|