Powershell script for o365 Usuage report

Welcome Forums General PowerShell Q&A Powershell script for o365 Usuage report

This topic contains 4 replies, has 3 voices, and was last updated by

Hil
 
Participant
6 months ago.

  • Author
    Posts
  • #100392
    Hil

    Participant
    Points: 1
    Rank: Member

    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.

  • #100399

    Participant
    Points: 0
    Rank: 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.

  • #100425

    Participant
    Points: 27
    Rank: 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.

The topic ‘Powershell script for o365 Usuage report’ is closed to new replies.