Wednesday, December 20, 2006

How much RAM have I got?

A small function to retrieve the number and size of RAM modules in a PC

function GetMem{
    $a = Get-WmiObject win32_physicalmemory -computername $args[0]
    Write-Host ("-" * 60)`n "Memory Configuration of" $args[0] `n("-" * 60)
    foreach ($b in $a) {
        Write-Host $b.tag `t $b.capacity "bytes" `t ($b.capacity/1mb) "mb"
    }
}

Usage:

GetMem

1 comment:

Anonymous said...

An alternative class
win32_logicalmemoryconfiguration