Tuesday, 2 December 2008

Get-PhysicalRam.ps1


# Get-PhysicalRAM.ps1
#
Sample using PowerShell
#
3rd sample from http://msdn.microsoft.com/en-us/library/aa394587
#
Thomas Lee

$mem = Get-WmiObject -Class Win32_ComputerSystem

# Display memory
"This system has {0} MB Free Memory" -f $($mem.TotalPhysicalMemory/1mb)
This script produces the following output:



PS C:\foo> .\Get-PhysicalRAM
This system has 8188.7421875 MB Free Memory


No comments: