Updated check-bios.ps1 and check-motherboard.ps1

This commit is contained in:
Markus Fleschutz 2024-10-10 20:41:36 +02:00
parent 83d8d645ee
commit 01d9659976
2 changed files with 9 additions and 11 deletions

View File

@ -5,7 +5,7 @@
This PowerShell script queries the BIOS status and prints it. This PowerShell script queries the BIOS status and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-bios.ps1 PS> ./check-bios.ps1
BIOS model P62 v02.67 by HP (version HPQOEM - 5, S/N CZC1080B01) BIOS model P62 v02.67, version HPQOEM - 5, S/N CZC1080B01 by HP
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -20,19 +20,19 @@ try {
$version = (sudo dmidecode -s bios-version) $version = (sudo dmidecode -s bios-version)
$releaseDate = (sudo dmidecode -s bios-release-date) $releaseDate = (sudo dmidecode -s bios-release-date)
$manufacturer = (sudo dmidecode -s system-manufacturer) $manufacturer = (sudo dmidecode -s system-manufacturer)
Write-Host "✅ BIOS model $model by $manufacturer (version $version of $releaseDate)" Write-Host "✅ BIOS model $model, version $version of $releaseDate by $manufacturer"
} }
Write-Progress -completed "." Write-Progress -completed "."
} else { } else {
$BIOS = Get-CimInstance -ClassName Win32_BIOS $BIOS = Get-CimInstance -ClassName Win32_BIOS
$model = $BIOS.Name.Trim() $model = $BIOS.Name.Trim()
$version = $BIOS.Version.Trim() $version = $BIOS.Version.Trim()
$serialNumber = $BIOS.SerialNumber.Trim() $serial = $BIOS.SerialNumber.Trim()
$manufacturer = $BIOS.Manufacturer.Trim() $manufacturer = $BIOS.Manufacturer.Trim()
if ($serialNumber -eq "To be filled by O.E.M.") { if ($serial -eq "To be filled by O.E.M.") {
Write-Host "✅ BIOS model $model by $manufacturer (version $version)" Write-Host "✅ BIOS model $model, version $version by $manufacturer"
} else { } else {
Write-Host "✅ BIOS model $model by $manufacturer (version $version, S/N $serialNumber)" Write-Host "✅ BIOS model $model, version $version, S/N $serial by $manufacturer"
} }
} }
exit 0 # success exit 0 # success

View File

@ -4,10 +4,8 @@
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the motherboard details. This PowerShell script lists the motherboard details.
.EXAMPLE .EXAMPLE
PS> ./list-motherboard.ps1 PS> ./check-motherboard.ps1
Motherboard Calla_LC by LN
Manufacturer : Gigabyte Technology Co., Ltd.
...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -18,7 +16,7 @@ try {
if ($IsLinux) { if ($IsLinux) {
} else { } else {
$details = Get-WmiObject -Class Win32_BaseBoard $details = Get-WmiObject -Class Win32_BaseBoard
"$($details.Product) motherboard by $($details.Manufacturer)" "Motherboard $($details.Product) by $($details.Manufacturer)"
} }
exit 0 # success exit 0 # success
} catch { } catch {