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.
.EXAMPLE
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
https://github.com/fleschutz/PowerShell
.NOTES
@ -53,7 +53,7 @@ try {
$DeviceID = $Details.DeviceID
$Speed = "$($Details.MaxClockSpeed)MHz"
$Socket = $Details.SocketDesignation
"$Status CPU $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)"
"$Status $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)"
}
exit 0 # success
} catch {

View File

@ -41,19 +41,19 @@ function GetRAMType { param([int]$Type)
}
function Bytes2String { param([int64]$Bytes)
if ($Bytes -lt 1000) { return "$Bytes bytes" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)KB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)MB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)GB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)TB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)PB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)EB" }
if ($Bytes -lt 1024) { return "$Bytes bytes" }
$Bytes /= 1024
if ($Bytes -lt 1024) { return "$($Bytes)KB" }
$Bytes /= 1024
if ($Bytes -lt 1024) { return "$($Bytes)MB" }
$Bytes /= 1024
if ($Bytes -lt 1024) { return "$($Bytes)GB" }
$Bytes /= 1024
if ($Bytes -lt 1024) { return "$($Bytes)TB" }
$Bytes /= 1024
if ($Bytes -lt 1024) { return "$($Bytes)PB" }
$Bytes /= 1024
if ($Bytes -lt 1024) { return "$($Bytes)EB" }
}
try {
@ -68,7 +68,7 @@ try {
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
$Manufacturer = $Bank.Manufacturer
$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