Get-MailboxStatistics for all users

Zach Summers 1 Reputation point

I need to run Get-MailboxStatistics to get the Calendar item count for all users in my domain. I'd prefer to not have to manually type in 150+ names to do this.

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
6,098 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,628 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 62,156 Reputation points Microsoft MVP

    Get-MailboxStatistics does not expose any folder-level details, nor the number of Calendar items. For that, you need Get-MailboxFolderStatistics. Here's a sample:

    Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited | % { Get-MailboxFolderStatistics $_.UserPrincipalName -FolderScope Calendar | ? {$_.FolderType -eq "Calendar"} | select Identity,ItemsInFolder,FolderSize } | Export-CSV -nti blabla.csv

  2. KyleXu-MSFT 25,616 Reputation points

    @Zach Summers

    You could change it into a script:

    $Mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited  
    $data = @()  
    foreach($mailbox in $mailboxes){  
        $data+=Get-MailboxFolderStatistics $mailbox.UserPrincipalName -FolderScope Calendar| where{$_.FolderType -eq "Calendar"} | select Identity,FolderSize  
    $data | Export-Csv C:\Users\demo\Desktop\2.csv -NoTypeInformation  

    If you still get an error about it, you could add a delay in this script:

    Please note: Do not run this script multiple times in a short period of time. Otherwise you will be restricted by Exchange online.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.