Use Group-Object to group objects based on shared property values, but don’t forget to use –NoElement parameter to discard the actual objects and return only the frequency.
Here is a simple line telling you what the file types are that you have in a given folder:
Get-ChildItem -Path c:\Windows -File | Group-Object -Property Extension -NoElement
The result may look like this:
Count Name ----- ---- 11 .exe 1 .dat 9 .log 4 .xml 1 .txt ...
By specifying -NoElement, you save considerable memory because the original objects are not included in the result.