How to do it...

The Get-Process cmdlet can fetch us this information.

  1. At the prompt, type the following to get all the parameters that the Get-Process cmdlet accepts.
PS> Get-Help Get-Process
  1. 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
  1. Run the command:
PS> Get-Process -IncludeUserName
  1. 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
  1. Count the number of processes running under your name.
PS> (Get-Process -IncludeUserName | grep ram).Count
  1. If you would like to use the Measure-Object cmdlet, you can.
PS> Get-Process -IncludeUserName | grep ram | Measure-Object
  1. 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.77.71