how to generate a report for exchange mailbox archive

MKHULEKO THABISO NHLAMBO 0 Reputation points
2025-01-29T07:20:52.2433333+00:00

I need assistance to generate a report for all exchange mailbox archives with used and available space for all users.

Microsoft Exchange Online
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Zhang-MSFT 4,105 Reputation points Microsoft Vendor
    2025-01-29T07:39:29.84+00:00

    Hello, @MKHULEKO THABISO NHLAMBO,

    Welcome to the Microsoft Q&A platform!

    To generate a report for all Exchange mailbox archives with used and available space for all users, you can use PowerShell.

    Here’s a script that can help you get started:

    # Connect to Exchange Online
    Connect-ExchangeOnline
    
    
    # Get mailbox archive statistics
    $Mailboxes = Get-Mailbox -Archive | Get-MailboxStatistics
    
    
    # Create a report
    $Report = @()
    foreach ($Mailbox in $Mailboxes) {
        $Report += [PSCustomObject]@{
            User             = $Mailbox.DisplayName
            ArchiveUsedSpace = [math]::round($Mailbox.TotalItemSize.Value.ToMB(), 2)
            ArchiveAvailableSpace = [math]::round(($Mailbox.StorageLimitStatus - $Mailbox.TotalItemSize.Value.ToMB()), 2)
        }
    }
    
    # Export the report to a CSV file, replace "C:\MailboxArchiveReport.csv" with your csv location
    $Report | Export-Csv -Path "C:\MailboxArchiveReport.csv" -NoTypeInformation
    

    Test Results: User's image

    This script will:

    1. Connect to Exchange Online.
    2. Retrieve mailbox archive statistics.
    3. Create a report with the user's display name, used archive space, and available archive space.
    4. Export the report to a CSV file.

    Make sure you have the necessary permissions to run these commands and that the Exchange Online PowerShell module is installed. Should you need more help on this, you can feel free to post back. 


    If the answer is helpful, please click on “Accept answer” as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.

    Thank you for your support and understanding.

    Best Wishes,

    Alex Zhang


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.