mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-21 02:37:35 +01:00
Update check-ram.ps1
This commit is contained in:
parent
3030e020bb
commit
3e80e5cb68
@ -14,12 +14,12 @@
|
|||||||
function GetRAMType { param([int]$Type)
|
function GetRAMType { param([int]$Type)
|
||||||
switch($Type) {
|
switch($Type) {
|
||||||
2 { return "DRAM" }
|
2 { return "DRAM" }
|
||||||
5 { return "EDO RAM" }
|
5 { return "EDO" }
|
||||||
6 { return "EDRAM" }
|
6 { return "EDRAM" }
|
||||||
7 { return "VRAM" }
|
7 { return "VRAM" }
|
||||||
8 { return "SRAM" }
|
8 { return "SRAM" }
|
||||||
10 { return "ROM" }
|
10 { return "ROM" }
|
||||||
11 { return "Flash RAM" }
|
11 { return "Flash" }
|
||||||
12 { return "EEPROM" }
|
12 { return "EEPROM" }
|
||||||
13 { return "FEPROM" }
|
13 { return "FEPROM" }
|
||||||
14 { return "EPROM" }
|
14 { return "EPROM" }
|
||||||
@ -28,31 +28,47 @@ function GetRAMType { param([int]$Type)
|
|||||||
17 { return "SDRAM" }
|
17 { return "SDRAM" }
|
||||||
18 { return "SGRAM" }
|
18 { return "SGRAM" }
|
||||||
19 { return "RDRAM" }
|
19 { return "RDRAM" }
|
||||||
20 { return "DDR RAM" }
|
20 { return "DDR" }
|
||||||
21 { return "DDR2 RAM" }
|
21 { return "DDR2" }
|
||||||
22 { return "DDR2 FB-DIMM" }
|
22 { return "DDR2 FB-DIMM" }
|
||||||
24 { return "DDR3 RAM" }
|
24 { return "DDR3" }
|
||||||
26 { return "DDR4 RAM" }
|
26 { return "DDR4" }
|
||||||
27 { return "DDR5 RAM" }
|
27 { return "DDR5" }
|
||||||
28 { return "DDR6 RAM" }
|
28 { return "DDR6" }
|
||||||
29 { return "DDR7 RAM" }
|
29 { return "DDR7" }
|
||||||
default { return "RAM" }
|
default { return "RAM" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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" }
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
# TODO
|
# TODO
|
||||||
} else {
|
} else {
|
||||||
$Banks = Get-WmiObject -Class Win32_PhysicalMemory
|
$Banks = Get-WmiObject -Class Win32_PhysicalMemory
|
||||||
foreach ($Bank in $Banks) {
|
foreach ($Bank in $Banks) {
|
||||||
$Capacity = $Bank.Capacity / (1024 * 1024 * 1024)
|
$Capacity = Bytes2String($Bank.Capacity)
|
||||||
$Type = GetRAMType $Bank.SMBIOSMemoryType
|
$Type = GetRAMType $Bank.SMBIOSMemoryType
|
||||||
$Speed = $Bank.Speed
|
$Speed = $Bank.Speed
|
||||||
[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)"
|
||||||
"✅ $($Capacity)GB $($Type) at $($Location) ($($Speed)MHz, $($Voltage)V by $Manufacturer)"
|
"✅ RAM $Capacity at $Location ($Type, $($Speed)MHz, $($Voltage)V, $Manufacturer)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user