Get the memory usage of a process, grouped, so you get the total.
Example; chrome, always have one process per page, use this to get the total of memory used by all of them.
$Processes = get-process chrome,iexplore | Group-Object -Property ProcessName foreach($Process in $Processes) { $Obj = New-Object psobject $Obj | Add-Member -MemberType NoteProperty -Name Name -Value $Process.Name $Obj | Add-Member -MemberType NoteProperty -Name Memory -Value ([decimal]::round((($Process.Group|Measure-Object WorkingSet -Sum).Sum)/1024/1024)) $Obj }
From Laurent’s comments below, another take on this with the following code, which lists all open processes, with total memory:
ps | Group ProcessName | Select Name, @{Label="Mem";Expression={($_.group |Measure WorkingSet -sum).Sum / 1MB }} | Sort Mem
All other suggestions are welcome !
2 thoughts on - PowerShell Get Memory used by a group of processes
here is a more command line friendly version of this tip:
https://foobarcode.wordpress.com/2014/12/12/memory-usage-grouped-by-process-name/
This version is also shorter and leverage powershell units conversions
(Get-Process chrome | Measure-Object WorkingSet -sum).sum /1GB
Done.