December 2nd, 2013

PowerTip: Use PowerShell to Group Processes in Windows

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to group the numbers of processes in Windows.  

Hey, Scripting Guy! Question How can I use Windows PowerShell to determine the number of processes that are running—
          for example, if I notice that there are multiple copies of the same processes running?

Hey, Scripting Guy! Answer Use the Get-Process cmdlet, group the output on the Name property, and sort the count
          where there is more than one instance of the process.

In Windows PowerShell 4.0 or Windows PowerShell 3.0:

Get-Process | group name | sort count -Descending | where count -gt 1

In Windows PowerShell 2.0 or earlier:

Get-Process | group name | sort count -Descending | where {$_.count -gt 1}

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.