From 3bfa372584009b18c1f145b5dab033a01e2d71c1 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 13 Dec 2022 08:27:19 +0100 Subject: [PATCH] Update check-cpu.ps1 and check-ram.ps1 --- Scripts/check-cpu.ps1 | 4 ++-- Scripts/check-ram.ps1 | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Scripts/check-cpu.ps1 b/Scripts/check-cpu.ps1 index fc4dd832..8c351382 100755 --- a/Scripts/check-cpu.ps1 +++ b/Scripts/check-cpu.ps1 @@ -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 { diff --git a/Scripts/check-ram.ps1 b/Scripts/check-ram.ps1 index 9daaeb68..6389e11c 100644 --- a/Scripts/check-ram.ps1 +++ b/Scripts/check-ram.ps1 @@ -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