RayofCommand
RayofCommand

Reputation: 4244

Single Value Total Ram / Free Ram free memory / total memory

I am looking for a way to find single cooked value output of total memory and memory in use.

gwmi Win32_OperatingSystem | select TotalVisibleMemorySize, FreePhysicalMemory

so far i have this, but i need only the value output.

for both of them.

thanks in advance shay ;)

Upvotes: 2

Views: 7467

Answers (2)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200363

Try this:

gwmi Win32_OperatingSystem | % {
  $_.TotalVisibleMemorySize
  $_.FreePhysicalMemory
}

Upvotes: 4

mikekol
mikekol

Reputation: 1862

If I correctly understand what you're asking for, I think this will help:

$memoryInfo = gwmi -Query "SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM Win32_OperatingSystem"
$totalVisibleMemorySize = $memoryInfo.TotalVisibleMemorySize
$freePhysicalMemory     = $memoryInfo.FreePhysicalMemory

Upvotes: 3

Related Questions