PowerShell Genie
Practice Compare process working sets

Compare process working sets

Exercise 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Return the two processes with the largest working sets.

An example to inspect

Preview the example. Sign in for the full lesson and activities.

Get-Process | Sort-Object WS -Descending | Select-Object -First 2 Name, WS

The task

A workstation feels slow. Produce a small memory-use snapshot without confusing working-set bytes with CPU seconds.

Target

Return the two processes with the largest working sets.

What the result tells you

Working set measures resident memory at the observation time. One snapshot is not proof of a leak; compare repeated measurements and workload.

Verify the result

Run the source by itself and inspect the sample objects. Add each filter separately, then check the final properties and order.

The browser uses a small fictional dataset. Real results depend on the host, module, account and target environment.

Can one large working set prove a memory leak?

Choose an answer, then check your reasoning.

Worked solution

Worked solution

Reveal one approach
1PS> Get-Process | Sort-Object WS -Descending | Select-Object -First 2 Name, WS

Related reference

Read the command and platform requirements
Next exercise

Try it in the lab

Write your pipeline below and run it against the fictional sample data, then check your result against the expected answer.

Interactive simulation · fictional data
Genie guideCompare process working sets

Return the two processes with the largest working sets.