Script to collect and export the mailbox properties from Get-Mailbox and Get-MailboxStatistics cmdlets to a CSV file
This script can be extended based on the required attributes
Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, SamAccountName,servername,database, RecipientTypeDetails,PrimarySmtpAddress, HiddenFromAddressListsEnabled, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, @{label="TotalItemSize";expression={(Get-MailboxStatistics $_).TotalItemSize}}, @{label="DeletedItemCount";expression={(Get-MailboxStatistics $_).DeletedItemCount}}, @{label="TotalDeletedItemSize";expression={(Get-MailboxStatistics $_).TotalDeletedItemSize}}, @{label="MailboxGuid";expression={(Get-MailboxStatistics $_).MailboxGuid}}, @{label="LastLogoffTime";expression={(Get-MailboxStatistics $_).LastLogoffTime}}, @{label="LastLogonTime";expression={(Get-MailboxStatistics $_).LastLogonTime}},IssueWarningQuota, ProhibitSendQuota Export-Csv "Path to the output file " -NoTypeInformation