Filter by memory use in PowerShell
Documentation: Microsoft Learn
Write a pipeline, run it against the sample data, and check your result.
Target
Return processes with more than 100 MiB of working-set memory. The WS property is measured in bytes.
Expected result
chrome, MsMpEng
Try the task
Show a worked solution
Reveal one approach
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.
Follow the objects
Run the command to inspect each stage.
PowerShell skills
Process objects · Filtering
Build the answer in three decisions
Read the pipeline from left to right. Each stage receives objects from the stage before it.
Collect
Get-Process
Start with 5 fictional process objects. Keep them as objects so later stages can inspect their properties.
Shape
Where-Object WS -gt 100MB
Apply the condition or ordering required by the task. PowerShell understands 100MB as 104857600 bytes. Compare WS against that threshold.
Verify
Check the returned names
The fixture should return chrome, MsMpEng. For this exercise, equivalent matching names can pass even when their order is different.
Reason through the pipeline
The source stage returns 5 process objects. Then the pipeline applies Where-Object WS -gt 100MB without converting the objects to display text. That keeps the Name property available for the checker and for any later pipeline stage.
Why common attempts fail
Do not hard-code the expected names; express the filter against an object property so the pipeline still makes sense when the fixture changes.
What the checker accepts
The evaluator runs the supported subset against the same fictional fixture. It expects chrome, MsMpEng. The checker compares the matching names without requiring a specific order. Equivalent supported syntax is accepted.
Verify another attempt
First run Get-Process by itself and inspect the fixture. Then add one stage at a time and compare how many objects remain. This isolates the stage that changes the result and makes the final pipeline easier to explain and debug.