Author Posts

May 9, 2018 at 6:01 pm

We are a hybrid Org with most user mailboxes in the cloud. I need to create a report of users receiving the largest email count.
I could log in to Office 365 admin portal > Reports > Usage. But I am trying to get the same report using powershell or at least the report of users receiving the largest email count.

Any ideas would be really appreciated.

May 9, 2018 at 7:05 pm

I'll take a stab at this one, and I think it can be done in a one liner.

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object ItemCount -Descending

You could do some more with this like pipe it into a quick "Select-Object" and only grab the name/username/itemcount or other information. You could also filter out the top ten with Select-Object by saying "-first 10".

Let me know if this gets you pointed in the right direction.

May 9, 2018 at 9:37 pm

Thanks Bryce.
Yes I could use that command, although running it against 50K users would throttle my connection.
The other option would be like using a REST API (
Any experience in this area?

May 10, 2018 at 9:58 pm

You could try running the command that Bryce provided with -ResultSize X (where X is any size you want to test). That would limit the run length.

The link to the API is out of date (that particular one has been deprecated in favor of Microsoft Graph (link is provided at the page your link refers to). You will need an API access token which should be found in the Admin Center. You would use Invoke-WebRequest -URI $URI (where $URI = full Graph report URL ). The Graph documentation is pretty easy to follow.