Recently I’ve been struggling to find out how many users are there in a single mailbox…the following worked great after spending 4 hour of time…..wasted…due to lack of knowledge…anyway thought I should share this so that it might save time for you guys…
get-recipient “some user” | select name, @{Name=”Count”;Expression={[array]($_.EmailAddresses).Count}}
Or just for SMTP addresses,
get-recipient “some user” | select name, @{Name=”Count”;Expression={[array]($_.EmailAddresses | Where {$_ -like “smtp*”}).Count}}
The Select creates “Count” with an expression, a cast array, using [array], of the contents of Get-Recipient’s property $_.EmailAddresses. This array is then counted. Note that the cast is used so that when $_.EmailAddresses has only one email addresses is still can be counted as an array.
The command produces an exact count of how many email addresses each mailbox has, period 🙂