How to Use Get-Process in PowerShell: Syntax and Examples
Use the
Get-Process cmdlet in PowerShell to list all running processes or filter specific ones by name or ID. You can run Get-Process alone to see all processes or add parameters like -Name to target specific processes.Syntax
The basic syntax of Get-Process allows you to retrieve information about running processes. You can use it without parameters to get all processes or specify parameters to filter results.
- Get-Process: Lists all running processes.
- -Name <string[]>: Filters processes by their names.
- -Id <int[]>: Filters processes by process IDs.
- -ComputerName <string[]>: Gets processes from remote computers.
powershell
Get-Process [-Name <string[]>] [-Id <int[]>] [-ComputerName <string[]>]Example
This example shows how to list all running processes and then filter to show only the processes named notepad.
powershell
Get-Process Get-Process -Name notepad
Output
Handles NPM(K) PM(K) WS(K) CPU(s) Id ProcessName
------- ------ ----- ----- ------ -- -----------
123 10 15000 20000 0.03 1234 powershell
200 15 25000 30000 0.10 5678 explorer
Handles NPM(K) PM(K) WS(K) CPU(s) Id ProcessName
------- ------ ----- ----- ------ -- -----------
30 5 5000 7000 0.01 4321 notepad
Common Pitfalls
One common mistake is using -Name with incorrect or partial process names, which returns no results. Also, forgetting that process names are case-insensitive but must be exact can cause confusion. Another pitfall is expecting Get-Process to show services; it only shows processes.
powershell
Get-Process -Name note # Correct usage: Get-Process -Name notepad
Output
Get-Process : Cannot find a process with the name "note".
At line:1 char:1
+ Get-Process -Name note
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (note:String) [Get-Process], ProcessCommandException
+ FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand
Quick Reference
| Parameter | Description |
|---|---|
| -Name | Filter processes by name (e.g., notepad, chrome) |
| -Id | Filter processes by process ID |
| -ComputerName | Get processes from remote computers |
| No parameters | List all running processes |
Key Takeaways
Use
Get-Process without parameters to list all running processes.Filter processes by name using
-Name with exact process names.Process names are case-insensitive but must be exact to return results.
Get-Process shows processes, not Windows services.Use
-Id to target processes by their process ID.