Powershell Get-Process and Task Manager discrepancy

powershell

I'm making a PowerShell script to get the top 10 process that are consuming memory, based on the Get-Process's value Working Set (WS). I'm running the following line and getting the results, looks great, but when I check in task manager I don't get the same values. Even the order is different.

Get-Process | Sort WS -Descending | Select Name,WS -First 10

Getting this:

PowerShell

Then task manager has this:

Task Manager

Are some other calculations I have to do? Could anyone explain?

PS: OS is in Portuguese.

Best Answer

Ok, just realized what was happening. The dafault "Memory" column in Task Manager is actually representing the Private Working Set, not Working Set from Powershell, that represents private and shared memory with other process. Just enabled the "Memory - Working Set" column in Task Manager and it matches.

Task Manager

Obviously the values in Powershell are in bytes, need to calculate to Mb.

This page was also helpful:

http://windows.microsoft.com/en-us/windows/what-task-manager-memory-columns-mean#1TC=windows-7