Update check-cpu.ps1 and check-ram.ps1

This commit is contained in:
Markus Fleschutz 2022-12-13 08:27:19 +01:00
parent 60cab826d7
commit 3bfa372584
2 changed files with 16 additions and 16 deletions

View File

@ -5,7 +5,7 @@
This PowerShell script queries CPU details (name, type, speed, temperature, etc.) and prints it. This PowerShell script queries CPU details (name, type, speed, temperature, etc.) and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-cpu PS> ./check-cpu
CPU AMD Ryzen 5 5500U with Radeon Graphics (CPU0, 2100MHz, 31.3°C) AMD Ryzen 5 5500U with Radeon Graphics (CPU0, 2100MHz, 31.3°C)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -53,7 +53,7 @@ try {
$DeviceID = $Details.DeviceID $DeviceID = $Details.DeviceID
$Speed = "$($Details.MaxClockSpeed)MHz" $Speed = "$($Details.MaxClockSpeed)MHz"
$Socket = $Details.SocketDesignation $Socket = $Details.SocketDesignation
"$Status CPU $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)" "$Status $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)"
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -41,19 +41,19 @@ function GetRAMType { param([int]$Type)
} }
function Bytes2String { param([int64]$Bytes) function Bytes2String { param([int64]$Bytes)
if ($Bytes -lt 1000) { return "$Bytes bytes" } if ($Bytes -lt 1024) { return "$Bytes bytes" }
$Bytes /= 1000 $Bytes /= 1024
if ($Bytes -lt 1000) { return "$($Bytes)KB" } if ($Bytes -lt 1024) { return "$($Bytes)KB" }
$Bytes /= 1000 $Bytes /= 1024
if ($Bytes -lt 1000) { return "$($Bytes)MB" } if ($Bytes -lt 1024) { return "$($Bytes)MB" }
$Bytes /= 1000 $Bytes /= 1024
if ($Bytes -lt 1000) { return "$($Bytes)GB" } if ($Bytes -lt 1024) { return "$($Bytes)GB" }
$Bytes /= 1000 $Bytes /= 1024
if ($Bytes -lt 1000) { return "$($Bytes)TB" } if ($Bytes -lt 1024) { return "$($Bytes)TB" }
$Bytes /= 1000 $Bytes /= 1024
if ($Bytes -lt 1000) { return "$($Bytes)PB" } if ($Bytes -lt 1024) { return "$($Bytes)PB" }
$Bytes /= 1000 $Bytes /= 1024
if ($Bytes -lt 1000) { return "$($Bytes)EB" } if ($Bytes -lt 1024) { return "$($Bytes)EB" }
} }
try { try {
@ -68,7 +68,7 @@ try {
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0 [float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
$Manufacturer = $Bank.Manufacturer $Manufacturer = $Bank.Manufacturer
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)" $Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
"RAM $Capacity at $Location ($Type, $($Speed)MHz, $($Voltage)V, $Manufacturer)" "$Capacity RAM at $Location ($Type, $($Speed)MHz, $($Voltage)V, $Manufacturer)"
} }
} }
exit 0 # success exit 0 # success