Friday, March 9, 2018

Select Objects from a List

In this previous post, we saw how to use PowerShell to find our processes, sorted by CPU:

 Get-Process | Sort-Object CPU -Descending


But most computers have a lot of processes. What if we wanted to know, say, the top 10 processes consuming CPU cycles? Well then, we can funnel our results through another pipeline into the cmdlet Select-Object:

 Get-Process | Sort-Object CPU -Descending | Select-Object -First 10

 

 

No comments:

Post a Comment