Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Apparently the .NET framework has a bug that prevents working set values above 2GB from accurately being determined. Between 2 and 4GB one can apply some xor-ing calculation to obtain the value, but there's no means of obtaining working set values greater than 4GB (using .Net or WMI)

What method can be used - preferably from a PowerShell script - to obtain an accurate measurement of a process' working set when the working set is greater than 4GB?

(some side details can be found in this StackOverflow question)

share|improve this question
    
So WMI has the same issue? (Would imply that .NET is using WMI and the defect is in WMI.) –  Richard Jul 10 '12 at 20:02

2 Answers 2

up vote 2 down vote accepted

This is for monitoring a specific process:

"\Process(<process name>)\Working Set" | get-counter -computer <computer>

The output is in bytes, but you can convert it to GB in the following command:

"\Process(<process name>)\Working Set" | get-counter -computer <computer>
| ForEach {$_.CounterSamples} | ForEach {[math]::round($_.cookedvalue/1GB,2)}

Edit: Reading the SO post, I see you are trying to just get any processes over 4 GB, without passing a specific process to the script. Below is a script that will do this, and here is a link to a Scripting Guy blog article that explains how to use the Get-Counter cmdlet:

"\Process(*)\Working Set" | Get-Counter -computer <computer>
| ForEach {$_.CounterSamples} | ? {$_.cookedvalue -gt 4294967296} | ft -AutoSize
share|improve this answer
    
Outstanding. So simple. Thank you for clearing the forest of the trees. Like other performance counters, Passing a * as the process name returns the working set for all processes. Thanks again, August. –  Shoeless Jul 11 '12 at 12:28

I know it's an old question but still alive, this show real 64bit memory usage in powershell:

get-process $Processname -computername $Computername | ft Name,ID,VirtualMemorySize64,PeakVirtualMemorySize64,WorkingSet64,PeakWorkingSet64

and this show memory usage over gps |where {$_.workingset64 -gt 4000Mb }|ft name,pm,workingset64,id

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.