Get-WmiObject Win32_OperatingSystem -ComputerName $computer | Select @{Label = "Computer"; Expression = {$computer}},
@{Label = "MemoryUsage"; Expression = {100 - [math]::Round(($_.FreePhysicalMemory/$_.TotalVisibleMemorySize)*100,0)}}
Returns the total percentage of memory ultization on your local or remote system.
PS C:\> $computer = 'localhost' >> Get-WmiObject Win32_OperatingSystem -ComputerName $computer | Select @{Label = "Computer"; Expression = {$computer}}, >> @{Label = "MemoryUsage"; Expression = {100 - [math]::Round(($_.FreePhysicalMemory/$_.TotalVisibleMemorySize)*100,0)}} Computer MemoryUsage -------- ----------- localhost 69