Check amount of RAM on windows with PowerShell

Saturday, February 23, 2008

You can check the amount of RAM on your windows box and can verify if any more slots are availiable or not if you want to add more RAM.

Use this code to check the RAM and Memory slot status:

$computer = "."
gwmi -co $computer -class win32_memorydevice | `
ft -prop DeviceID,StartingAddress,EndingAddress, `
@{
Label="Size";
Expression={[math]::round(($_.EndingAddress - $_.StartingAddress)/1024,0)}
}

You can save this code into a file with a .ps1 extension like ramcheck.ps1

Now execute it with ./ramcheck.ps1

You will see an output something like this.

With this example you can see that this machine has 2 GB of RAM in 2 slots no.1 and no.3 and both RAM chips have the size of 1GB each.

StartingAddress and EndingAddress helps you to determine the size of chip in the memory slot.

-- Anish

0 comments:

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP