You may want to group similar outputs for some cmdlets.The Group-Object cmdlet examines a object property and creates a new group for each property.

[powershell]Get-Service | Group-Object status[/powershell]


As you see above, two different groups were created by group-object cmdlet as Stopped and Running.

Group-Object is less useful if each property have unique names.

I mean;

[powershell]Get-Service | Group-Object name[/powershell]

will group all unique names one by one and will display almost the same output with Get-Service cmdlet.

I think the real benefit of Group-Object cmdlet is Count column.You can check for how many objects are in each group quickly.

Leave a Reply

Your email address will not be published. Required fields are marked *

22 − = 16