I can't figure this out - it's drilling a hole through me.
OK so I run ->
Get-Mailbox -ResultSize Unlimited | Select Alias,PrimarySmtpAddress
It works I get all the mailboxes.
Get-Mailbox -Identity "sample" | Select Alias,PrimarySmtpAddress
It finds the user.
but if I run the code (pasted) below when It's supposed to output the number of mailboxes it shows 0 even though the answer is one.
I don't get how it can't count the mailbox and can count them all.
I'm running on this Exchange 2010 EWS powershell