
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.
Get All Exchange Online Mailboxes:
To list all the mailboxes, run the Get-Mailbox cmdlet after creating the Exchange Online PowerShell session.
Get-Mailbox –ResultSize Unlimited
Get Mailbox Details using PowerShell:
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.
List All Shared Mailboxes:
To view all the shared mailboxes in your Exchange online environment, run the cmdlet as below.
Get-Mailbox -ResultSize Unlimited | Where {$_.RecipientTypeDetails -eq “SharedMailbox”}
Get Mailbox Size using PowerShell:
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.
Export Mailbox Details to CSV:
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.
View Mailbox Details in Grid View:
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
Having Trouble Managing Mailboxes through PowerShell?
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 Exchange Online reporting tool.
AdminDroid provides 390+ Exchange Online statistics and auditing reports along with smart dashboards. Each report provides AI-powered graphical analysis to gain insights and better understand the data in a visually appealing manner.
Additionally, AdminDroid provides 1500+ pre-built reports and 20 smart dashboards to know more about your Office 365 environment at a glance.
Besides, AdminDroid offers 100+ 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. Download 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.