Group-Object

noun

say it: “GROOP OB-jekt” /ˈɡrup ˈɑbdʒɛkt/

A PowerShell command that sorts objects into groups that share the same value of one property.

What does Group-Object do?

Group-Object sorts the objects that arrive into piles that share one property's value, such as every file with the same Extension. Each pile has a Count (how many), a Name (the shared value) and a Group (the objects themselves). -NoElement leaves the objects out.

Get-ChildItem -Recurse -File | Group-Object Extension -NoElement | Sort-Object Count -Descending

In a sentence

  • “Each group Group-Object makes has a Count, a Name and the files themselves.”
  • “Group-Object Extension sorted the drive's files into piles of .mp3, .mp4, .jpg and more.”

Level: Apprentice · More PowerShell terms at this level

Updated