The Get-Process cmdlet can fetch us this information.
- At the prompt, type the following to get all the parameters that the Get-Process cmdlet accepts.
PS> Get-Help Get-Process
- We see a parameter IncludeUserName (the name suggests it is a switch parameter). Get more information on it.
PS> Get-Help Get-Process -Parameter IncludeUserName
- Run the command:
PS> Get-Process -IncludeUserName
- Filter out the processes started by you. We will use grep for this operation, until we learn how to filter in PowerShell.
PS> Get-Process -IncludeUserName | grep ram
- Count the number of processes running under your name.
PS> (Get-Process -IncludeUserName | grep ram).Count
- If you would like to use the Measure-Object cmdlet, you can.
PS> Get-Process -IncludeUserName | grep ram | Measure-Object
- Let us now see how what amount of working set all of the processes started by you consume.
PS> Get-Process -IncludeUserName | grep ram | Measure-Object -Property WS -Sum
There is an error.