Wednesday, June 09, 2010

Checking the type and size of RAM with Windows PowerShell

I subscribe to the PowerTip of the day email of PowerShell.com and I got this tip today. If you want to know the type and size of RAM your PC uses, and available banks, you can use the following script:

$memorytype = "Unknown", "Other", "DRAM", "Synchronous DRAM", "Cache DRAM",
"EDO", "EDRAM", "VRAM", "SRAM", "RAM", "ROM", "Flash", "EEPROM", "FEPROM",
"EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", "RDRAM", "DDR", "DDR-2"
$formfactor = "Unknown", "Other", "SIP", "DIP", "ZIP", "SOJ", "Proprietary",
"SIMM", "DIMM", "TSOP", "PGA", "RIMM", "SODIMM", "SRIMM", "SMD", "SSMP",
"QFP", "TQFP", "SOIC", "LCC", "PLCC", "BGA", "FPBGA", "LGA"
$col1 = @{Name='Size (GB)'; Expression={ $_.Capacity/1GB } }
$col2 = @{Name='Form Factor'; Expression={$formfactor[$_.FormFactor]} }
$col3 = @{Name='Memory Type'; Expression={ $memorytype[$_.MemoryType] } }

Get-WmiObject Win32_PhysicalMemory | Select-Object BankLabel, $col1, $col2, $col3


The output would be something like:

BankLabel                     Size (GB) Form Factor         Memory Type
---------                     --------- -----------         -----------
                                      2 DIMM                DDR-2
                                      2 DIMM                DDR-2
                                      2 DIMM                DDR-2
                                      2 DIMM                DDR-2

It works pretty nice, doesn't it?

2 comments:

the man said...

can you update this to use DDR3 too?

Anonymous said...

This is helpful. Would you know if there is a similar powershell to get other info about the RAM, such as voltage?

Spring Boot Configuration Properties Localization

Spring Boot allows to externalize application configuration by using properties files or YAML files. Spring Profiles  provide a way to segr...