Remove ‘#’ to enable the properties you want to be retrieved
Connect-ExchangeOnline
# Get all user mailboxes
$mailboxes = Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox
# Create an array to store mailbox information
$mailboxInfo = @()
# Iterate through each mailbox and retrieve properties
#Remove # to enable the properties from being retrived
foreach ($mailbox in $mailboxes) {
$mailboxInfo += [PSCustomObject]@{
DisplayName = $mailbox.DisplayName
#UserPrincipalName = $mailbox.UserPrincipalName
License = $mailbox.Licenses
#Alias = $mailbox.Alias
#TotalItemSize = $mailbox.TotalItemSize
#IssueWarningQuota = $mailbox.IssueWarningQuota
#ProhibitSendQuota = $mailbox.ProhibitSendQuota
#ProhibitSendReceiveQuota = $mailbox.ProhibitSendReceiveQuota
}
}
# Export the mailbox information to a CSV file
$mailboxInfo | Export-Csv -Path "C:\Users\Public\Downloads\MailboxQuotaProperties.csv" -NoTypeInformation
# Disconnect from Exchange Online session
Disconnect-ExchangeOnline