# encoding: ascii
# api: powershell
# title: PS: Get RAM size
# description: Get the capacity of your installed RAM with the Win32_PhysicalMemory WMI class.
# version: 0.1
# type: class
# author: Florian Frank
# license: CC0
# x-poshcode-id: 4565
# x-archived: 2016-04-20T01:36:58
# x-published: 2016-10-27T22:22:00
#
#
# Type long (64-bit integer) is necessary because the WMI class state the capacity in byte --> might be too long for int32 ;-)
[long]$memory = 0

# Get the WMI class Win32_PhysicalMemory and total the capacity of all installed memory modules
Get-WmiObject -Class Win32_PhysicalMemory | ForEach-Object -Process { $memory += $_.Capacity }

# Display the output in Gigabyte
$memory / 1GB
