You can get information about the RAM installed on your computer through some built-in System Info tools or various 3rd party systems inventory utilities such as CPU-Z, or AIDA32. But here I am going to talk about how to use PowerShell, the built-in script tool that comes with Windows, to extract the same info from your local and remote computers.
How many memory slots do I have?
You can simply run the following cmdlet in PowerShell window to find out.
Get-WmiObject -class "Win32_PhysicalMemoryArray"
The MemoryDevices column indicates how many memory slots are available on your computer while MaxCapacity tells you how much total of RAM you can install.
To get the info from a remote computer, use -computername switch to the cmdlet. For example,
Get-WmiObject -class "Win32_PhysicalMemoryArray" -computername C-20141222B
How many memory sticks and a total of RAM installed?
The following cmdlet reveals this information in a single run.
Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum
And again, adding -computername switch in the end if you want to get the info from a remote computer.
Get-WmiObject Win32_PhysicalMemory -computername C-20141222B | Measure-Object -Property Capacity -Sum
Gathering other memory info
The win32_physicalmemory class has tons of properties that you can use to pull from your computer, such as FormFactor, SerialNumber, Speed, etc. You just need to call them up and format them properly. Piping out to Out-GridView is probably the easiest way to get a clear view of what type of RAM you have installed on your computer.
Get-WmiObject Win32_PhysicalMemory -computername C-20141222B | Out-GridView
Putting everything together
And of course, it’s nice if we can put all codes together in a PowerShell format so we can easily run it to get all information at once whether from a local or remote computer. Download the full script below, and run it in a form of:
ram.ps1 -computername remotecomputer
What to do when security policy prevents the script from running?
When you see the security warning that prevents the script from running, open an elevated PowerShell Window and run the following and give it an “Y” answer.