How to get free physical memory of remote computer using PowerShell

culter picture culter · Sep 3, 2012 · Viewed 31.6k times · Source

I have this:

(Get-WMIObject Win32_logicaldisk -computername computer).TotalPhysicalMemory

to get size of physical memory installed on remote computer. How do I get the FREE memory of that computer?

I've tried

(Get-WMIObject Win32_logicaldisk -computername computer).FreePhysicalMemory

and some other variants, but with no effect. Is there some list of possible "filters"?

Answer

latkin picture latkin · Sep 3, 2012

Whenever you want to see all of the properties of an object, pipe it to Format-List *.

Get-WmiObject Win32_LogicalDisk | format-list *
Get-WmiObject Win32_OperatingSystem | fl *

Or if you are looking for a particular propery, you can use wildcard search

Get-WmiObject Win32_OperatingSystem | fl *free*

As Aquinas says, you want the Win32_OperatingSystem class, FreePhysicalMemory property. Win32_LogicalDisk tracks hard disks, not RAM.