Add check-bios.ps1

This commit is contained in:
Markus Fleschutz 2022-11-14 13:33:53 +01:00
parent 8ec7113298
commit d645f5940d
6 changed files with 35 additions and 5 deletions

29
Scripts/check-bios.ps1 Normal file
View File

@ -0,0 +1,29 @@
<#
.SYNOPSIS
Checks BIOS details
.DESCRIPTION
This PowerShell script queries BIOS details and prints it.
.EXAMPLE
PS> ./check-bios
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
if ($IsLinux) {
# TODO
} else {
$BIOS = Get-CimInstance -ClassName Win32_BIOS
$Manufacturer = $BIOS.Manufacturer
$Model = $BIOS.Name
$SerialNumber = $BIOS.SerialNumber
$Version = $BIOS.Version
"$Manufacturer BIOS $($Model): S/N $SerialNumber, version $Version"
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -46,7 +46,7 @@ try {
} else {
$Details = Get-WmiObject -Class Win32_Processor
$DeviceName = $Details.Name.trim()
"$DeviceName ($($Details.DeviceID), $($Details.MaxClockSpeed)MHz, $Temp)."
"$($DeviceName): $($Details.DeviceID), $($Details.MaxClockSpeed)MHz, $Temp"
}
exit 0 # success
} catch {

View File

@ -14,6 +14,7 @@
& "$PSScriptRoot/check-operating-system.ps1"
& "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-time-zone.ps1"
& "$PSScriptRoot/check-bios.ps1"
& "$PSScriptRoot/check-cpu.ps1"
& "$PSScriptRoot/check-ram.ps1"
& "$PSScriptRoot/check-gpu.ps1"

View File

@ -25,7 +25,7 @@ try {
$BuildNo = $OSDetails.BuildNumber
$Serial = $OSDetails.SerialNumber
$InstallDate = $OSDetails.InstallDate
"$Name ($Arch, v$Version, S/N $Serial, installed $($InstallDate.ToShortDateString()))."
"$($Name): $Arch, v$Version, S/N $Serial, installed $($InstallDate.ToShortDateString())"
}
exit 0 # success
} catch {

View File

@ -52,7 +52,7 @@ try {
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
$Manufacturer = $Bank.Manufacturer
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
"$($Capacity)GB $Type ($($Speed)MHz, $($Voltage)V) at $Location by $Manufacturer."
"$($Capacity)GB $($Type) by $($Manufacturer): $($Speed)MHz, $($Voltage)V at $Location"
}
}
exit 0 # success

View File

@ -5,7 +5,7 @@
This PowerShell script queries S.M.A.R.T. HDD/SSD device details and prints it.
.EXAMPLE
PS> ./check-smart-devices
1TB Samsung SSD 970 EVO via NVMe, 37°C, 2388 hours, 289x on, v2B2QEXE7, selftest passed.
1TB Samsung SSD 970 EVO via NVMe: 37°C, 2388 hours, 289x on, v2B2QEXE7, selftest passed
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -65,7 +65,7 @@ try {
$PowerOn = $Details.power_cycle_count
$Hours = $Details.power_on_time.hours
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "FAILED" }
"$($Capacity)$ModelName via $Protocol, $($Temp)°C, $($Hours) hours, $($PowerOn)x on, v$($Firmware), selftest $Status."
"$($Capacity)$ModelName via $($Protocol): $($Temp)°C, $($Hours) hours, $($PowerOn)x on, v$($Firmware), selftest $Status"
}
exit 0 # success
} catch {