export mailbox information

Glenn Maxwell 13,141 Reputation points
2022-11-28T18:18:27.837+00:00

Hi All

I am using exchange 2016 hybrid environment. we create mailboxes in onprem and migrate to online. i want to export all my mailboxes size along with Recoverable items folder size and Litigation hold status. i want to try something like the below experts guide me. can i pull the data in GB

foreach($users in Get-Mailbox -ResultSize Unlimited){$users | Foreach-Object {      
$user = $_     
$stats = Get-MailboxStatistics $user.Name  
Get-MailboxFolderStatistics  $user.Name -FolderScope RecoverableItems | Where-Object {$_.FolderPath -eq "/Recoverable Items"}            
New-Object -TypeName PSObject -Property @{          
DisplayName = $User.DisplayName  
FirstName = $User.FirstName  
LastName = $User.LastName  
userprincipalname = $User.userprincipalname  
primarysmtpaddress = $User.primarysmtpaddress  
IssueWarningQuota = $User.IssueWarningQuota          
ProhibitSendQuota = $User.ProhibitSendQuota          
ProhibitSendReceiveQuota = $User.ProhibitSendReceiveQuota         
TotalItemSize = $stats.TotalItemSize      
LitigationHoldEnabled = $User.LitigationHoldEnabled  
RecoverableItems = $User.RecoverableItems           
}   
}  
}| export-csv "c:\temp\output.csv" -NotypeInformation  
Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Exchange | Exchange Server | Management
Exchange | Exchange Server | Management
The administration and maintenance of Microsoft Exchange Server to ensure secure, reliable, and efficient email and collaboration services across an organization.
Exchange | Hybrid management
Exchange | Hybrid management
The administration of a hybrid deployment that connects on-premises Exchange Server with Exchange Online, enabling seamless integration and centralized control.
{count} votes

Answer accepted by question author
  1. KyleXu-MSFT 26,396 Reputation points
    2022-11-29T02:14:48.21+00:00

    @Glenn Maxwell

    This blog will be useful to you: Get Exchange Online Mailbox Size in GB
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    264920-1.png


    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.


    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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