This topic contains 4 replies, has 3 voices, and was last updated by
May 9, 2018 at 6:01 pm #100392
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 #100399ParticipantPoints: 0Rank: Member
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 #100404
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 (https://msdn.microsoft.com/en-us/library/office/dn387058.aspx)
Any experience in this area?
May 10, 2018 at 9:58 pm #100425ParticipantPoints: 43Rank: Member
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.
May 11, 2018 at 2:36 am #100429
Thanks Matt. I missed that.
I believe this is what I needed https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/reportroot_getemailactivityusercounts
The topic ‘Powershell script for o365 Usuage report’ is closed to new replies.