Updated 3 months 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. If you use the admin center for managing mailboxes, you need to navigate to multiple admin centers, for example,

  • To view mailbox details, you need to use the Exchange admin center.
  • To audit the mailbox activities, you must use the security and compliance center.
  • To know mailbox usage statistics, you need to adopt usage reports available Microsoft 365 admin center.

So, most admins prefer PowerShell to manage, report, audit, and analyze their Exchange Online Environment.

This blog lists the top 15 use-cases to monitor your Exchange Online environment in a better way. (Then, what is the best way?? I will tell you in the later section).

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.

Note: To use the ‘Connect-ExchangeOnline’ cmdlet, you need to install Exchange Online PowerShell (EXO V2) Module. Else, you can use the PowerShell script to connect Office 365 services.

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

Get Office 365 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

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.

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

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.

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.

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.

Get Mailbox Forwarding Using PowerShell

Email forwarding 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

Note: Email forwarding can be configured in many ways. For e.g., through configuring inbox rules, Forwarding Address, Redirect To, etc.

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

Having Trouble in Managing Exchange Online Through PowerShell?

If you are new to Office 365, it’s challenging to identify the correct PowerShell cmdlet to get the desired report. Even after finding the cmdlet, it will eat your time to format the output in the required form. If you are looking for a way to generate a report with just a few mouse clicks, you can take a look at AdminDroid Microsoft 365 reporting and auditing tool.

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

AdminDroid Office 365 auditing tool

Additionally, AdminDroid offers 100+ 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 Office 365 reporting tool by AdminDroid and see how it works for you.

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

Share article