Display Microsoft 365 Mailbox Information using Exchange Online PowerShell

Microsoft 365 is the advance version of MS Office; it can be made even more advance with simple PowerShell cmdlets that can make your work easier with quick mailbox information access by running specific commands.

In this article, we would take an extended look into using the Exchange Online PowerShell to view different information related to the Microsoft 365 user mailbox. If you have Microsoft 365 administrator or Global Administrator login authorization, you can work on the Exchange Online PowerShell given that you have some technical knowledge on using the Exchange Online PowerShell and running cmdlets on it.

Here, start with following process to display the Microsoft 365 mailbox Information.

First of all, you must connect Windows PowerShell with user’s Microsoft 365 account to use the Exchange Online PowerShell. You can do it by using the following steps:-

Connect to Microsoft 365 with Exchange Online PowerShell

  1. Open Window PowerShell by right clicking on its application and selecting the Run as administrator option.
  2. After opening the Windows PowerShell screen, run the following command to login in Microsoft 365
    $UserCredential = Get-Credential

    After running this command, a dialogue box would pop up asking for your Microsoft 365 account login credentials. Provide username, password and then click OK.

  3. Create a new power cell session from Microsoft 365 server. Run the following command.
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic –AllowRedirection
  4. Finally import the session. Run the following command.
    Import-PSSession $Session -DisableNameChecking

    Note: if you do not find any error then go to next step. If you find any error like file cannot be loaded because running scripts is disabled on this system then need to change your PowerShell execution policy.

  5. Now that you have connected Microsoft 365 with Exchange Online PowerShell, you can run any command on it to view its user mailbox information.

How to get information about Microsoft 365 mailboxes using Exchange Online PowerShell?

There is a Get-Mailbox cmdlet In Exchange Online PowerShell which helps you to get Microsoft 365 mailbox information.
Now you will get all mailbox information-

1) How to get Microsoft 365 Mailbox Information?

To get mailbox information, use this command.

Get-Mailbox -ResultSize unlimited

You will get information as a summary detail of all the user mailboxes within the organization.

To get information about all the mailboxes within a specific Organization Unit, execute the following command.

Get-Mailbox -OrganizationalUnit <Organizational Unit Name>

You will get information as a list of all the mailboxes available within the specified Organization Unit.

To find out the archive mailboxes in a specified Mailbox Server, use the following command.

Get-Mailbox -Archive -Server <Mailbox Server Name>

You will get information as a list of archived mailboxes in the specified Mailbox Server.

There are other uses of the Get-mailbox cmdlet like retrieving properties information from a single or multiple Microsoft 365 mailboxes.

2) How to get Microsoft 365 Mailbox properties information?

If you want to get information about all the properties of a specific user mailbox in your Microsoft 365 organization, run the following command.

Get-Mailbox -Identity “<user mailbox name>” | Format-List

You will get information about all the properties of a specified user mailbox.

If you want to get general information about a specific mailbox, use the following command.

Get-Mailbox -Identity “<user mailbox name>”

It will display some general mailbox properties such as Name, Alias, Server Name and ProhibitSendQuota

If you want to have the prioritized information about the user mailboxes, use the Format List pipeline as in the following command.

Get-Mailbox -Identity “<user mailbox name>” | Format-List DisplayName, LitigationHoldEnabled, LitigationHoldDate

You will get all information about the specified properties in the command like Display Name and Litigation hold properties.

If you want to get information about all mailboxes with specified properties, use the following command

Get-Mailbox -ResultSize unlimited | Format-Table DisplayName, LitigationHoldEnabled -Auto

You get all information about the specified properties like Display Name, Litigation hold properties for all the mailboxes in the organization.

Now, let us know how to get more details and retrieve information related to mailbox folders within the organization using Exchange Online PowerShell commands.

3) How to get Microsoft 365 Mailbox Folders Information?

If you want to get information about all folders in a specific mailbox, use the following command.

Get-MailboxFolder -Identity <mailbox name>

You will get information as the list of root folders within the specified mailbox.

If you want to get information related to a specific folder within the specified mailbox, use the following command.

Get-MailboxFolder -Identity <mailbox name>:\Inbox

You will get information about the Inbox folder of the specified user mailbox.

To view information related to a specific folder in a user mailbox, this is the command.

Get-MailboxFolderStatistics -Identity <mailbox name> -FolderScope Calendar

You will get information about all the properties of the Calendar folder within the specified mailbox.

If you want to get information about the mailbox sizes by running some cmdlets in Exchange Online PowerShell, follow the next section.

4) How to get Microsoft 365 Mailbox Size Information?

To get the size of a specific mailbox, you need to run this command.

Get-Mailbox -Identity <mailbox name> | Get-MailboxStatistics | Format-Table DisplayName, TotalItemSize, ItemCount -Autosize

You get information: Information about the size of a specified mailbox.

If you want to get information about the exporting information to a CSV file by running some cmdlets in Exchange Online PowerShell.

5) How to get Microsoft 365 Export Mailbox Information?

To get Export Mailbox information and export it to the CSV file format, you need to run a cmdlet as given below.

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress,EmailAddresses,EmailAddresses | Export-CSV C:\Temp\”Exchange Online recipients.CSV” –NoTypeInformation -Encoding UTF8

Note: Replace CSV with TXT, XML or HTML file formats in Export-CSV C:\Temp\”Exchange Online recipients.CSV” to save the information to the respective file formats.

6) How to get Microsoft 365 Mailbox permission report?

To identify users with permissions, you need to run this command.

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}
7) How to get Microsoft 365 Inactive Mailbox information?

If you want to get information related to Inactive mailboxes which can be identified by using the mailbox’s last logon time or last activity time, use the following command.

Get-Mailbox -ResultSize Unlimited |Foreach{Get-MailboxStatistics -Identity $_.UserPrincipalName | Select DisplayName,LastLogonTime,LastUserActionTime}

Apart from the above major cmdlets of the Exchange Online PowerShell, there are more possibilities to identify and view the Microsoft 365 mailboxes information.

Those Exchange Server organizations who are still looking a perfect way to move to Microsoft 365 platform can try the professional Microsoft 365 migration tool to migrate their on-premises, and hosted Exchange Server data to the cloud account swiftly and flexibly using smart integrated filters and options.

Conclusion

I hope this blog will help you to get information about how to display Microsoft 365 mailbox information using the Exchange Online PowerShell. You can get mailbox information, mailbox properties, mailbox folders information, mailbox size information, Inactive mailboxes information, mailbox permission report and export mailbox information with the help of certain cmdlets. A perfect cloud migration tool is also suggested towards the end.