Kernel Data Recovery Blog

How to display Microsoft 365 mailbox information using Exchange Online PowerShell?

Read time 5 minutes

Summary: This blog discusses the simple and technical approach to displaying Microsoft 365 mailbox information using Exchange Online PowerShell. With the helpful commands and procedures outlined, users can easily monitor mailbox statistics, view shared mailbox permissions, and more. To enhance your mailbox management experience, we recommend using Kernel Office 365 Backup and Restore tool.

In this technologically advanced era, even a complicated task can be done within a few seconds. So is the case with Office 365. Admins must perform various tasks and that becomes much easier when they start using PowerShell commands. They can be used to manage, audit, view, analyze, and audit the overall functioning of the Exchange Online. Here, we will be discussing how to view the mailbox data using Exchange Online PowerShell.

But before we begin, ensure you have these two pre-requisites:

Connecting Exchange Online PowerShell

  1. Search for PowerShell on your system, right-click on Windows PowerShell, and select Run as Administrator option.
  2. The Windows PowerShell screen will open. First, run this command.
    $UserCredential = Get-Credential

    Running this command will open a dialogue box asking for your Microsoft 365 account login credentials (username and password). Provide them and click OK.

  3. Run the following command.
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  4. Finally, run this command.
    Import-PSSession $Session -DisableNameChecking
  5. Now, you are connected to the Exchange Online PowerShell.

So, we have provided you the process for connecting to Exchange Online PowerShell above. Now, let us know how this Exchange Online PowerShell helps you get information regarding Microsoft 365 mailboxes.

In Exchange Online PowerShell, there is a Get-Mailbox cmdlet which helps to get Microsoft 365 mailbox information.

Let us know about all its uses.

Mailbox information

  1. To retrieve mailbox information, try this command.
    Get-Mailbox -ResultSize unlimited

    Output: A summary list of all the mailboxes within the organization.

  2. To receive all the mailboxes within a specific Organization Unit, execute this command.
    Get-Mailbox -OrganizationalUnit <Organizational Unit Name>

    Output: A list of all the mailboxes available within the specified Organization Unit.

  3. To find out the archive mailboxes in a Mailbox Server, use this command.
    Get-Mailbox -Archive -Server <Mailbox Server Name>

    Output: A list of archived mailboxes in the specified Mailbox Server.

There are more uses for the Get-mailbox cmdlet like retrieving properties information from a single or multiple Microsoft 365 mailboxes. Let us go through them.

Mailbox properties

  1. If you want to get all the properties of a specific user mailbox in your organization, run this command.
    Get-Mailbox -Identity “<user mailbox name>” | Format-List

    Output: All the properties of a specified user mailbox.

  2. To get general information about a specific mailbox, use this command.
    Get-Mailbox -Identity “<user mailbox name>”

    Output: Displays some general mailbox properties such as Name, Alias, Server Name and ProhibitSendQuota

  3. Using the Format List pipeline, users can get prioritized information about the user mailboxes as given below.
    Get-Mailbox -Identity “<user mailbox name>” | Format-List DisplayName, LitigationHoldEnabled, LitigationHoldDate

    Output: Information based on the specified properties in the command – Display Name and Litigation hold properties.

  4. For all mailboxes with specified properties , this is the command.
    Get-Mailbox -ResultSize unlimited | Format-Table DisplayName, LitigationHoldEnabled -Auto

    Output: Shows the specified properties – Display Name, Litigation hold properties for all the mailboxes in the organization.

When dealing with a large number of mailboxes, it is often necessary to filter and analyze only a subset of them. In such cases, PowerShell’s Where-Object cmdlet can be used in conjunction with the Get-Mailbox cmdlet to retrieve the desired subset of mailboxes. To provide the filter condition, a filter phrase needs to be formulated in the syntax “–“.

The comparison operator can take on values like “eq” (equals), “ne” (not equals), “gt” (greater than), “lt” (less than), etc. The comparison is usually performed in a case-insensitive manner unless specified otherwise.

To retrieve the filtered subset of mailboxes, the Where-Object cmdlet is used in conjunction with the Get-Mailbox cmdlet. The syntax for this is:

“Get-Mailbox -ResultSize unlimited | Where-Object {$_.

In this syntax, the “unlimited” parameter is used to make sure that all existing mailboxes are considered in the result, and the “

Now, let us go into more detail and retrieve information related to mailbox folders in the organization using Exchange Online PowerShell commands.

Mailbox folders information

  1. To retrieve all the folders in a specific mailbox, use this command.
    Get-MailboxFolder -Identity <mailbox name>

    Output: List of all the root folders within the specified mailbox

  2. For getting information related to a specific folder within the specified mailbox, here is the command.
    Get-MailboxFolder -Identity <mailbox name>:\Inbox

    Output: Inbox folder of the specified user mailbox is retrieved.

  3. To view information related to a specific folder in a user mailbox, this is the command.
    Get-MailboxFolderStatistics -Identity <mailbox name> -FolderScope Calendar

    Output: All the properties of the Calendar folder within the specified mailbox.

It is also possible to know about the mailbox sizes by running some cmdlets in Exchange Online PowerShell.

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

Output: Information about the specified mailbox.

Also, there comes one more cmdlet which allows exporting information to a CSV file.

Export mailbox information

Export your output information after running a cmdlet to a file format like CSV using this command.

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.

Hence, we have learnt about multiple commands in Exchange Online PowerShell which provides users varied information regarding the user mailboxes in the organization.

Summing up

The Exchange Online PowerShell is a powerful solution for displaying Microsoft 365 mailbox information quickly and easily. By utilizing the cmdlets available through PowerShell and connecting to Exchange Online, users can extract a wide range of mailbox-related information within seconds. This effortless solution saves time and allows for data to be exported in numerous file formats. If seeking a tool, Kernel Office 365 Backup and Restore is recommended.

FAQs

Q – How do I find the size of my Office 365 mailbox in PowerShell?

A – To view the mailbox size, you must use the Get-MailboxStatistics command with the mailbox identity. This will give you valuable information about your mailbox, including its size, total number of items & more.

Q – What is the PowerShell to check mailbox information?

A – The Get-Mailbox cmdlet is a handy command that allows administrators to view mailbox objects & attributes, as well as populate property pages with essential information. However, you must note that for Exchange Online PowerShell, experts recommend using the Get-EXOMailbox cmdlet instead.

Q – How do I find the number of mailboxes in Exchange Online PowerShell?

A – Head over to the Exchange Admin Center & navigate to recipients > mailboxes. You will find the total mailbox count at the bottom of the page.

Q – How do I find mailbox details in PowerShell?

A – First, make sure you know the identity of the mailbox you want to investigate. Then, use the command Get-Mailbox -Identity “<MailboxIdentity>” | Select-Object * to list out all the properties of that particular mailbox. This command will provide you with a full list of all the mailbox properties, which can be useful information for troubleshooting or management purposes.