Build object-based pipelines that filter, sort, select, and group information.

Sheet: 07 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026

PowerShell cheat sheet index

Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.

Quick commands

1. Filter by extension

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Where-Object { $_.Extension -eq '.html' }

2. Combine two conditions

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Where-Object { $_.Extension -eq '.html' -and $_.Length -gt 20KB }

3. Select a subset of properties

Get-ChildItem -LiteralPath 'C:\MGU' -File |
    Select-Object Name, Length, LastWriteTime

4. Extract one property as plain values

Get-ChildItem -LiteralPath 'C:\MGU' -File |
    Select-Object -ExpandProperty FullName

5. Sort and limit output

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Sort-Object Length -Descending | Select-Object -First 10

6. Group and count

Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
    Group-Object Extension | Select-Object Name, Count

Operational notes

$_ represents the current pipeline object. -eq compares equality, -like uses wildcards, and -match uses regular expressions. Keep Format-Table and Format-List at the display end of a pipeline.

Official documentation