Environment- MS Exchange 2010
We have about 10 Retention Policies in our environment and I would like to get a count of the number of mailboxes assigned to each policy. Here is the script I thought should do the trick, but didn't.
get-mailbox -resultsize unlimited| group-object -property:RetentionPolicy| sort-object Count -desc| select RetentionPolicy, Count
I have also tried -
get-mailbox -resultsize unlimited| group-object -property RetentionPolicy| sort-object Count -desc| select RetentionPolicy, Count
As I have seen this syntax as well. I have also tried running these scripts as Administrator to make sure that wasn't the issue.
While the count column gets populated the retention policy column is simply blank for all policies. When I remove the group-object section the script does populate the retention policy column, but ungrouped. The only thing I can think of is that the group-object doesn't like grouping by retention policy, though why this would be I can't fathom.
Can anyone straighten out this puzzle?
TIA