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.
1 |
Connect-ExchangeOnline |
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.
1 |
Get-ExoMailbox -ResultSize Unlimited |
Alternatively, you may also use the Get-Mailbox cmdlet.
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.
1 |
Get-ExoMailboxStatistics -Identity admin |select DisplayName,TotalItemSize |
If you want to get all the mailboxes’ size, combine both Get-Mailbox and Get-MailboxStatistics cmdlet as shown below:
1 |
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | select DisplayName,TotalItemSize |
The above example displays the mailboxes’ size as shown in the following screenshot.
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,
1 |
Get-Mailbox –ResultSize Unlimited –Archive |
To view archive mailboxes size,
1 |
Get-Mailbox –ResultSize Unlimited –Archive | Get-MailboxStatistics| Select DisplayName,TotalItemSize |
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,
1 |
Get-Mailbox -Identity John@contoso.com | select *quota* |
This will list John’s quota information such as Prohibit Send Quota, Prohibit Send Receive Quota, Issue warning Quota, Archive Quota, etc.
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.
1 |
Get-ExoMailbox –ResultSize Unlimited –RecipientTypeDetails 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,
1 2 |
Get-Mailbox | foreach { (Get-MailboxPermission -Identity $_.userprincipalname | where{ ($_.AccessRights -contains "FullAccess") -and ($_.IsInherited -eq $false) -and -not ($_.User -match "NT AUTHORITY") }) | select Identity,AccessRights,User} |
To get users with Send-as permission,
1 2 |
Get-Mailbox | foreach { (Get-RecipientPermission -Identity $_.userprincipalname | where{ -not (($_.Trustee -match "NT AUTHORITY") -or ($_.Trustee -match "S-1-5-21"))}) | select Identity,trustee} |
To get mailboxes with Send-on-behalf permission,
1 |
Get-Mailbox –ResultSize Unlimited | Where {$_.GrantSendOnBehalfTo -ne $null} | Select UserprincipalName,GrantSendOnBehalfTo |
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.
1 2 |
Get-Mailbox -ResultSize Unlimited |Foreach{ Get-MailboxStatistics -Identity $_.UserPrincipalName | Select DisplayName,LastLogonTime,LastUserActionTime} |
The above cmdlet produces output as follows:
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,
1 |
Get-mailbox -ResultSize Unlimited| where {$_.ForwardingAddress -ne $Null} | select DisplayName,ForwardingAddress |
The above cmdlet lists mailboxes in which email forwarding is configured through ForwardingAddress.
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.
1 |
Get-MailboxFolder -Identity admin@contoso.com -GetChildren |
To view assigned permission on a specific mailbox folder, use the Get-MailboxFolderPermission cmdlet as follows:
1 |
Get-MailboxFolderPermission -Identity "admin@contoso.com:\To me" |
The above example returns the list of user permissions for the ‘To me’ folder in admin’s mailbox.
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.
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.