How to Get Process in PowerShell: Simple Commands and Examples
Use the
Get-Process cmdlet in PowerShell to retrieve information about running processes. You can run Get-Process alone to list all processes or specify a process name like Get-Process -Name notepad to get details about a specific process.Syntax
The basic syntax to get processes in PowerShell is:
Get-Process: Lists all running processes.Get-Process -Name <processName>: Gets processes by their name.Get-Process -Id <processId>: Gets a process by its ID.
You can also use other parameters to filter or format the output.
powershell
Get-Process [-Name <string[]>] [-Id <int[]>] [<CommonParameters>]Example
This example shows how to list all running processes and then get details about the Notepad process specifically.
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 notepad
Common Pitfalls
Common mistakes include:
- Using incorrect process names (must match exactly, case-insensitive).
- Trying to get processes that require admin rights without running PowerShell as administrator.
- Expecting
Get-Processto return stopped or background services (it only shows running processes).
powershell
Get-Process -Name Notepad
# Correct: Process names are case-insensitive
Get-Process -Name notepad
# Correct: Use just the process name without extensionQuick Reference
Here is a quick cheat sheet for Get-Process usage:
| Command | Description |
|---|---|
| Get-Process | Lists all running processes |
| Get-Process -Name notepad | Gets the Notepad process details |
| Get-Process -Id 1234 | Gets the process with ID 1234 |
| Get-Process | Where-Object {$_.CPU -gt 10} | Lists processes using more than 10 seconds of CPU time |
Key Takeaways
Use Get-Process to list or find running processes in PowerShell.
Specify process names without extensions when using -Name parameter.
Run PowerShell as administrator to access all processes if needed.
Get-Process only shows running processes, not stopped services.
You can filter and format process output using PowerShell pipeline commands.