%{-join($_|% T*y|% *g|sort|group|? N* -m \w|% C*)}
Input comes from the pipeline.
Try it online!
Try it in a PS console:
$strings = 'acfzzA', 'Hello World!', '---!&*#$', '---!&*#$a', 'aaaaaaaaaaaaaaaaaaaaaaaaaaad', 'aaaaaaaaaad', 'cccbba', 'abbccc'
$result = $strings |
%{-join($_|% T*y|% *g|sort|group|? N* -m \w|% C*)}
1..($strings.Length-1)|%{"'$($strings[$_])' --> '$($result[$_])'"}
-5 by rearranging the first version %{-join($_|% T*y|% *g|?{$_-match'\w'}|sort|group|% C*t)}
; moving the "match" filter after the "group" allows the use of the "<Property> <Operator> <Value>" syntax of Where-Object instead of using a FilterScript.
-1 by removing the unnecessary "t" from "% C*t"
Explanation
%{...} "%" is an alias for the cmdlet "ForEach-Object", which accepts input from the pipeline and processes each incoming object inside the ScriptBlock {...}
-join(...) Unary operator which will join the all the character counts returned inside the expression
% T*y takes the input string and calls its method "ToCharArray()", turning the string into an array of single characters.
% *g takes the array of characters and turns them back to single-character strings by invoking ToString() (the only method matching "*g"), because Group-Object is case sensitive for characters, but not for strings.
sort is an alias for Sort-Object, which will sort the characters.
group is an alias for Group-Object, which will group the characters, and return objects with a Count property for each character; returns GroupInfo objects.
? N* -m \w "?" is an alias for "Where-Object", the rest expands to "-Property 'Name' -match '\w'" - this lets only objects pass where the Name property (which contains the grouped character) consists only of word (\w) characters. PS allows for partial named parameters, so -m will be identified as -match.
% C* gets the property "Count" (the only one starting with C) of the GroupInfo objects.
All the counts will now be collected and joined to a single string; output is implicit.
Ungolfed
ForEach-Object -Process {
-join ( # Will join the counts of all characters produced inside the brackets into a single string
$_ | # Input string
ForEach-Object -MemberName ToCharArray | # input string to single chars
ForEach-Object -MemberName ToString | # input chars to single-char strings
Sort-Object |
Group-Object | # group same characters
Where-Object -Property 'Name' -match '\w' | # let only word characters pass ("Name" contains the string/character used to group)
ForEach-Object -MemberName Count # get only the count of the grouped objects
)
}