From ce16c33272ba232888dbd64288afd81a396fef73 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 13 Oct 2022 19:51:02 +0200 Subject: [PATCH] Update check-ram.ps1 --- Scripts/check-ram.ps1 | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Scripts/check-ram.ps1 b/Scripts/check-ram.ps1 index 09a354d0..5c458aa5 100644 --- a/Scripts/check-ram.ps1 +++ b/Scripts/check-ram.ps1 @@ -41,22 +41,26 @@ function GetRAMType { param([int]$Type) } try { - $Banks = Get-WmiObject -Class Win32_PhysicalMemory - foreach ($Bank in $Banks) { - $Capacity = $Bank.Capacity / (1024 * 1024 * 1024) - $Type = GetRAMType $Bank.SMBIOSMemoryType - $Speed = $Bank.Speed - [float]$Voltage = $Bank.ConfiguredVoltage / 1000.0 - $Vendor = $Bank.Manufacturer - if ("$($Bank.BankLabel)" -ne "") { - $BankName = $Bank.BankLabel - } else { - $BankName = $Bank.DeviceLocator + if ($IsLinux) { + # TODO + } else { + $Banks = Get-WmiObject -Class Win32_PhysicalMemory + foreach ($Bank in $Banks) { + $Capacity = $Bank.Capacity / (1024 * 1024 * 1024) + $Type = GetRAMType $Bank.SMBIOSMemoryType + $Speed = $Bank.Speed + [float]$Voltage = $Bank.ConfiguredVoltage / 1000.0 + $Vendor = $Bank.Manufacturer + if ("$($Bank.BankLabel)" -ne "") { + $Location = $Bank.BankLabel + } else { + $Location = $Bank.DeviceLocator + } + "✅ $($Capacity)GB $Type ($($Speed)MHz, $($Voltage)V, $Vendor) in $Location bank." } - "✅ $($Capacity)GB $Type ($($Speed)MHz, $($Voltage)V, $Vendor) in $BankName bank." } exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 -} \ No newline at end of file +}