February 2019
Intermediate to advanced
626 pages
15h 51m
English
The Group-Object command shows a group and count for each occurrence of a value in a collection of objects.
Given the sequence of numbers shown, Group-Object creates a Name that holds the value it is grouping, a Count as the number of occurrences of that value, and a Group as the set of similar values:
PS> 6, 7, 7, 8, 8, 8 | Group-ObjectCount Name Group----- ---- ----- 1 6 {6} 2 7 {7, 7} 3 8 {8, 8, 8}
The Group property may be removed using the NoElement parameter, which simplifies the output from the command:
PS> 6, 7, 7, 8, 8, 8 | Group-Object -NoElementCount Name ----- ---- 1 6 2 7 3 8
Group-Object can group based on a specific property. For example, it might be desirable to list the number of occurrences of ...
Read now
Unlock full access