In PowerShell, you can retrieve a list of running processes on your system using the Get-Process cmdlet.
The following syntax shows how you get the process list.
Get-Process
This command will return a list of process objects representing all the processes that are currently running on your system. It returns the process properties such as ID, Name, CPU, and memory usage.
The following examples show how you can use it.
How to Get a List of All Processes in PowerShell
Use the Get-Process cmdlet in PowerShell to get the list of all processes currently running on your system.
Get-Process
Output:
This command gets a list of all active processes with several properties including ProcessName, ID, CPU, Memory (in bytes), and more.
How to Get Specific Process Properties in PowerShell
If you want to get specific process properties in PowerShell, you can use the Select-Object cmdlet.
Get-Process | Select-Object Id, Name
Output:
This will return the ID and Name properties of processes.
How to Filter Process List in PowerShell
Suppose, you want to list only the processes that have a memory usage higher than 100 MB.
Get-Process | Where-Object {$_.WorkingSet -gt 100MB} | Select-Object -Property Name, Id, WorkingSet
Output:
After running this script, it will return the processes list that have memory consumption higher than 100MB.
How to Get Specific Process Details in PowerShell
To get specific process details in PowerShell, you can use the Get-Process cmdlet with the -Name parameter to specify the name of the process you want to retrieve.
Get-Process -Name chrome
Output:
After running this script, it will retrieve information about a specific process named “chrome“.
How to Sort the Process Lists in PowerShell
To sort the process lists in PowerShell, you can use the Get-Process cmdlet and pipe the list to the Sort-Object cmdlet to sort them by CPU property in descending order.
Get-Process | Sort-Object -Property CPU -Descending
Output:
After running this script, it will sort the process list by their CPU usage in descending order.
Conclusion
I hope the above article on getting a process list and its information in PowerShell is helpful to you.
You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.