Get Mailbox Details in Microsoft 365 using PowerShell
This blog will help you get mailbox info with Get-Mailbox PowerShell cmdlets. Also, we have included examples to retrieve mailboxes’ properties. Let’s dive in!
You must connect to Exchange Online PowerShell to use EXO PowerShell cmdlets.
To list all the mailboxes, run the Get-Mailbox cmdlet after creating the Exchange Online PowerShell session.
Get-Mailbox –ResultSize Unlimited
To view all properties of a mailbox, you can run the Get-Mailbox cmdlet with a specific mailbox identity. For example,
Get-Mailbox –Identity [email protected] | Select *
It will list 200+ properties of a mailbox ‘John’.
To view specific properties for all the mailboxes, use the following format.
Get-Mailbox -ResultSize Unlimited | Select DisplayName,PrimarySMTPAddress
The example lists all the mailboxes and their email addresses. To get detailed reports on Microsoft 365 mailboxes’ primary SMTP address and alias, you can refer to the dedicated blog to get all Office 365 email addresses.
To view all the shared mailboxes in your Exchange online environment, run the cmdlet as below.
Get-Mailbox -ResultSize Unlimited | Where {$_.RecipientTypeDetails -eq “SharedMailbox”}
To view mailbox size, you can use the Get-MailboxStatistics cmdlet with the mailbox identity. To view all the mailboxes and their size, run the following cmdlet.
Get-Mailbox -ResultSize Unlimited | foreach { Get-MailboxStatistics -identity $_.userprincipalName | select Displayname,TotalItemSize}
Note: You can download the pre-built PowerShell script from o365reports.com to get a detailed mailbox size report. Moreover, you can also get mailbox folders and subfolders details to review the each folder size for all mailboxes in the organization.
To export mailboxes and their properties, you can use Export-CSV. For example, to export the archive status of mailboxes, you can run the below cmdlet.
Get-Mailbox -ResultSize Unlimited | Select DisplayName,ArchiveStatus | Export-Csv “D:\Export” -NoType
You can generate an archive mailbox size report to view the list of archive mailboxes and their size.
Instead of exporting mailbox details to a CSV file, you can view mailbox information in Grid view. Grid view helps you filter or sort the report by a specific column.
To view mailbox details in grid view, use the following cmdlet.
Get-Mailbox –ResultSize Unlimited | Select DisplayName,PrimarysmtpAddress,RecipientTypeDetails,SKUAssigned,AuditEnabled,GrantSendOnBehalfTo | Out-GridView
If you are a PowerShell novice, it is challenging to identify the appropriate cmdlet to generate desired mailbox report. If you want to get a report with just a few mouse clicks, you can try AdminDroid’s Exchange Online mailbox reports that include,
- Office 365 mailboxes
- All active and inactive mailboxes
- Never logged in mailboxes
- Mailbox over warning quota
- Shared mailbox report
- Mailbox size report
- Archive mailbox report
AdminDroid Exchange Online auditing tool offers 65+ extensive reports and smart dashboards that provide AI-powered graphical analysis to gain insights and understand the data in a visually appealing manner. From securing your mailboxes efficiently to seamless email management, the possibilities are endless with the valuable reports offered by AdminDroid Exchange Online management tool.
Besides, AdminDroid offers 190+ Azure AD reports and a handful of dashboards for free to manage your organization’s users, licenses, groups, group membership, membership changes, user logins, password changes, etc. The free version allows you to perform customization, scheduling, and exporting, etc.
Download the Free Office 365 reporting tool by AdminDroid and see how it works for you.
I hope this blog will help you manage mailboxes using PowerShell.