Sort Processes by Memory Usage with Get-Process
Rank running processes by working-set memory and CPU time in one PowerShell pipeline.
01Command
$ Get-Process | Sort-Object WS -Descending | Select-Object -First 15 Name, Id, @{n='Mem(MB)';e={[math]::Round($_.WS/1MB,1)}}, @{n='CPU(s)';e={[math]::Round($_.CPU,1)}} | Format-Table -AutoSize02What it does
WS (working set) is the process's current physical RAM footprint; WSPrivileged/PrivateMemorySize64 differ subtly, and PrivateMemorySize64 is the better figure for commit-charge questions. Adding CPU seconds distinguishes a memory hog that is idle from one that is burning the machine. This pipeline is the fast console equivalent of sorting Task Manager's Details tab, and piping to Stop-Process -Id makes cleanup one step away.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-Process - SS64Evidence: Shows sorting processes by working set and other memory-oriented examples.
- Get-ProcessEvidence: Documents Get-Process objects and their WS and CPU properties.
Last verified: 2026-09-17 · Category: System & Settings
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Register a recurring Windows task entirely from the command line — ideal for scripts, cleanup jobs, and monitoring probes you want to run unattended.
Create or update a .zip from any files or folder contents straight from PowerShell.