How to calculate and used memory of multiple instance of a single process using powershell? How to calculate and used memory of multiple instance of a single process using powershell? powershell powershell

How to calculate and used memory of multiple instance of a single process using powershell?


You can use the Measure-Object cmdlet

$measure = Get-Process svchost | Measure-Object PM -Sum$mem = ("{0:N2}MB " -f ($measure.sum / 1mb))


Also, you can calculate the total size of the entire collection using the += syntax

$mem = 0Get-Process svchost | %{$mem += $_.pm}"{0:N2}MB " -f ($mem/1mb)