Created
March 9, 2021 18:42
-
-
Save signalwarrant/0fdbcad68c567d49c5005e0dde1b97d3 to your computer and use it in GitHub Desktop.
Sort-Select.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Selecting | |
#Default | |
Get-Process | |
# All Properties | |
Get-Process | Select-Object -Property * | Out-GridView | |
# Sorting | |
# Changes the default sorting order for Get-Process | |
Get-Process | Sort-Object CPU | |
# Minimize the data and sort | |
Get-Process | Select-Object ProcessName, CPU | Sort-Object CPU -Descending | |
## Caution | |
# Mission: Get the top 10 processes by CPU usage (which 10 processes have the most CPU usage) | |
Get-Process | | |
Select-Object ProcessName, CPU -First 10 | | |
Sort-Object CPU -Descending | |
# or | |
Get-Process | | |
Sort-Object CPU -Descending | | |
Select-Object ProcessName, CPU -First 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment