mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 01:43:37 +01:00
Update check-ram.ps1
This commit is contained in:
parent
83d205e717
commit
ce16c33272
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user