Updated 2 weeks ago

Most Useful PowerShell Cmdlets to Manage Exchange Online Mailboxes

by Kathy Cooper

5 min read

No Comments

As a Microsoft 365 administrator, you can manage your Exchange Online environment through the Admin Center or PowerShell. However, using the Admin Center often requires navigating across multiple portals:

  • To view mailbox details, you need to use the Exchange Admin Center.
  • To audit mailbox activities, you must access the Purview portal.
  • To check mailbox usage statistics, you have to use Microsoft 365 usage reports in the Admin Center.

Due to this fragmentation, most admins prefer PowerShell for managing, reporting, auditing, and analyzing their Exchange Online environment more efficiently.

This blog lists the top 10 use cases to help you better monitor your Exchange Online environment. But what’s the best way to do it? 🤔 Don’t worry—I’ll reveal that in the later section! 😉 Stay tuned!

1. Connect to Exchange Online PowerShell:

To manage Exchange Online environment through PowerShell, you need to create a PowerShell session using the below cmdlet.

The above cmdlet allows you to connect to Exchange Online PowerShell with both MFA and non-MFA accounts. You can also connect to EXO PowerShell using certificates.

Note: Try the PowerShell script to connect multiple Microsoft 365 services with ease.

2. Exchange Mailbox Report:

Mailbox is a basic component of Exchange Online. To view mailboxes in your organization, run the Get-ExoMailbox cmdlet as shown below.

Alternatively, you may also use the Get-Mailbox cmdlet.

List all mailboxes PowerShell

3. Get Exchange Online Mailbox Size:

Monitoring mailbox size helps you to increase the mailbox storage limit at the right time.

To view the used size of the mailbox, run Get-MailboxStatistics or Get-ExoMailboxStatistics cmdlet.

If you want to get all the mailboxes’ size, combine both Get-Mailbox and Get-MailboxStatistics cmdlet as shown below:

The above example displays the mailboxes’ size as shown in the following screenshot.

Get mailbox size PowerShell

You can also use the dedicated PowerShell script to export mailbox size report along with quota limit.

4. Get Archive Mailbox in Exchange Online:

Archiving offers an additional mailbox to the user’s primary mailbox. So, the admin can enable archiving to the mailbox when it requires more storage.

To get archive enabled mailboxes,

To view archive mailboxes size,

To know more about archive mailboxes’ size, status, and quota, run our PowerShell script to generate an archive mailbox size report. Also, the script provides information about auto-expanding archive status.

5. Get Mailbox Quota Information:

Mailbox storage quota helps you to manage mailbox size and database growth. Once the mailbox reaches its quota, certain actions like sending emails, receiving emails are restricted. So, the admins need to keep an eye on the mailbox quota.

To view the quota of a specific mailbox,

This will list John’s quota information such as Prohibit Send Quota, Prohibit Send Receive Quota, Issue warning Quota, Archive Quota, etc.

Get mailbox quota PowerShell

6. List Shared Mailboxes:

A shared mailbox is a type of user mailbox, but users can’t directly login to it by using a username and Password. To access the shared mailbox, users must have certain permissions such as full access, send as, and send on behalf on the shared mailbox.

To list shared mailboxes in your organization, use the RecipientTypeDetails filter with the value SharedMailbox.

To view users’ permission on the shared mailboxes, you can use our pre-built script to generate the shared mailbox permission report.

7. Get Mailbox Permission Report:

Like shared mailbox, user mailbox also can be delegated with full access, send as, and send on behalf permissions. To identify users with each permission, execute the following cmdlets.

To get users with Full Access permission on mailboxes,

To get users with Send-as permission,

To get mailboxes with Send-on-behalf permission,

Get mailbox permission report

If you want to get a consolidated report on mailbox permissions, you can download the script to generate a mailbox permission report. This PowerShell script finds Office 365 users who have full access, send-as, and send-on-behalf permission on other mailboxes, and export them to CSV file.

8. Identify Inactive Mailboxes:

Inactive mailboxes can be identified by using the mailbox’s last logon time or last activity time.

The Get-MailboxStatistics cmdlet helps you to get mailboxes’ last logon time and last activity time.

The above cmdlet produces output as follows:

find Inactive mailbox report

Try our script to generate an inactive mailbox report along with additional attributes such as inactive days, mailbox type, assigned licenses, admins roles, etc.

9. Get Mailbox Forwarding Using PowerShell

Email forwarding configuration allows admins/users to forward email from the mailbox to another mailbox automatically.

To list mailboxes configured with automatic email forwarding,

The above cmdlet lists mailboxes in which email forwarding is configured through ForwardingAddress.

mailbox Email forwarding report

Email forwarding can be configured in many ways, such as through configuring inbox rules, Forwarding Address, Redirect To, Forwarding SMTP address, etc. To get a consolidated report on all email forwarding configurations, you can use PowerShell.

Tip: It’s important to identify external email forwarding, as it poses a major security risk. Regularly review your organization’s configuration and block external forwarding based on your security requirements.

10. Get Mailbox Folder Permission:

When you don’t want to delegate the entire mailbox, use the ‘folder permission’ feature to grant access to a specific folder only.

To view folders available in the mailbox, run the Get-MailboxFolder along with the mailbox’s identity.

To view assigned permission on a specific mailbox folder, use the Get-MailboxFolderPermission cmdlet as follows:

The above example returns the list of user permissions for the ‘To me’ folder in admin’s mailbox.

Get Mailbox folder permission PowerShell

You can also use our dedicated PowerShell script to export mailbox folder permission report for better visibility and control.

Having Trouble in Managing Exchange Online Through PowerShell?

If you’re new to Microsoft 365, identifying the correct PowerShell cmdlet to generate the desired report can be challenging. Even after finding the right cmdlet, formatting the output to meet your needs can be time-consuming.

If you’re looking for a quick and efficient way to generate reports with just a few clicks, check out the AdminDroid Microsoft 365 Reporting and Auditing Tool.

AdminDroid provides 1900+ pre-built reports and 30+ visually appealing dashboards to know more about your Office 365 environment at a glance. The reports include various M365 services such as Entra, Exchange Online, SharePoint Online, Microsoft Teams, OneDrive for Business, Stream, and security reports. By using ‘Views’ and ‘Advanced Filter’ options, you can create custom reports based on your requirement.

Exchange Online Dashboard by AdminDroid

Exchange Online mailbox size report

Additionally, AdminDroid offers 120+ reports and a handful of dashboards as 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 too. Download Free Microsoft 365 reporting tool by AdminDroid and see how it works for you.

I hope this blog will help you in manage Exchange Online environment efficiently. Which method do you prefer to generate reports? Share your thoughts through the comment section.

Share article