create method that counts all the elements in an array a and returns a hash with their counts.
$array = @('abc','ff','abc','abc','ff','r') $array.tally() abc ff r 3 2 1
You can use Group-Object cmdlet.
Most helpful comment
You can use Group-Object cmdlet.