Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (2024)

One of the most used PowerShell commands used by Exchange administrators is the Get-Mailbox cmdlet. This cmdlet has been available since Exchange Server 2007 and up to the latest version (2019 as of this writing) and Exchange Online.

The Get-Mailbox cmdlet’s purpose is simple—retrieve information about mailboxes in your Exchange organization. In this article, we’ll show several practical examples of using Get-Mailbox to get information about Exchange mailboxes.

Contents

Get Information on a Specific Mailbox

Exchange administrators often view the information of one mailbox at a time using the Exchange Admin Center.

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (1)

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (2)

You can get the information using the Get-Mailbox cmdlet by specifying the mailbox identity.

Get-Mailbox -Identity <mailbox identity>

The -Identity parameter accepts the following mailbox identifiers.

  • Name
  • Alias
  • Distinguished name (DN)
  • Canonical DN
  • Domain
  • Email address
  • GUID
  • LegacyExchangeDN
  • SamAccountName
  • User ID or user principal name (UPN)

Default Property Set

As you can see below, the default property set the Get-Mailbox cmdlet returns include the Name, Alias, ServerName, and ProhibitSendQuota.Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (3)

Running the same command in Exchange Online PowerShell returns a different property set that includes the Name, Alias, Database, ProhibitSendQuota, and ExternalDirectoryObjectId.

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (4)

But you can find all Get-Mailbox properties by piping the resultant mailbox object to the Get-Member cmdlet.

Get-Mailbox -Identity <mailbox identity> | Get-Member -MemberType Properties

Get All Mailbox

Running the Get-Mailbox cmdlet without parameters returns up to 1000 mailboxes.

$mailboxCollection = Get-Mailbox$mailboxCollection.Count

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (5)

But this limit can be adjusted by adding the -ResultSize parameter. This parameter accepts a number to indicate how many mailboxes to return. For example, the command below returns a maximum of 5000 mailboxes.

$mailboxCollection = Get-Mailbox -ResultSize 5000$mailboxCollection.Count

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (6)

The -ResultSize parameter also accepts the word Unlimited, which indicates to return all mailboxes.

$mailboxCollection = Get-Mailbox -ResultSize Unlimited$mailboxCollection.Count

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (7)

Get Mailbox in a Specific Database

Another typical Get-Mailbox usage is finding which mailboxes are in a specific database. Note that this usage applies only to Exchange Servers and not to Exchange Online.

For example, the command below gets the mailboxes in the DB02 mailbox database.

Get-Mailbox -Database DB02 | Format-Table DisplayName,ServerName,Database

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (8)

Get Mailbox of a Specific Type

When running the Get-Mailbox cmdlet, you can also get specific mailbox types using the RecipientTypeDetails parameter. This parameter accepts one or more mailbox types from this list:

  • DiscoveryMailbox
  • EquipmentMailbox
  • GroupMailbox (Exchange 2013 or later and Exchange Online)
  • LegacyMailbox
  • LinkedMailbox
  • LinkedRoomMailbox (Exchange 2013 or later and Exchange Online)
  • RoomMailbox
  • SchedulingMailbox (Exchange 2016 or later and Exchange Online)
  • SharedMailbox
  • TeamMailbox (Exchange 2013 or later and Exchange Online)
  • UserMailbox

The example command below lists the SharedMailbox and RoomMailbox mailbox types.

Get-Mailbox -RecipientTypeDetails SharedMailbox,RoomMailbox | Format-Table DisplayName,RecipientTypeDetails

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (9)

Get Mailbox Filtered by Attributes

The Get-Mailbox cmdlet has a -Filter parameter that lets you filter the mailbox objects to return by their attributes. You can filter mailboxes based on properties like Alias, PrimarySMTPAddress, City, Company, etc.

You can find a comprehensive list of filterable properties at Filterable properties for the Filter parameter on Exchange cmdlets.

For example, the below command filters mailboxes whose Alias property value starts with Jo.

Get-Mailbox -Filter "Alias -like 'Jo*'"

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (10)

Note that not all properties support wildcard (*) character comparison. But if they do, the wildcard character comparison is supported as a suffix (word*) and not a prefix (*word). Even if a prefix wildcard worked in some instances, Microsoft does not recommend it due to low-performance issues.

Another example is listing mailboxes on litigation hold. This example filters mailboxes whose LitigationHoldEnabled property is set to True. Below are four variations of this filtering example that perform the same comparison operation.

Get-Mailbox -Filter 'LitigationHoldEnabled -eq $true' | Format-Table DisplayName, LitigationHoldEnabledGet-Mailbox -Filter "LitigationHoldEnabled -eq `$true" | Format-Table DisplayName, LitigationHoldEnabledGet-Mailbox -Filter { LitigationHoldEnabled -eq $true } | Format-Table DisplayName, LitigationHoldEnabledGet-Mailbox -Filter { LitigationHoldEnabled -eq 'true' } | Format-Table DisplayName, LitigationHoldEnabled

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (11)

Get Mailbox Sorted by Size

The mailbox size property is not included in the mailbox object returned by Get-Mailbox. You can get the TotalItemSize using the Get-MailboxStatistics cmdlet instead.

Typically, you can pipe the Get-Mailbox results to Get-MailboxStatistics like so:

Get-Mailbox | Get-MailboxStatistics

However, if the mailbox identity is ambiguous (not unique), you’ll get an error similar to this:

Get-MailboxStatistics: Ex838C9A|Microsoft.Exchange.Configuration.Tasks.ManagementObjectAmbiguousException | The specified mailbox Identity:“mailbox” isn’t unique.

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (12)

To avoid getting that error, it’s better to process each mailbox through a loop, like the ForEach-Object Loop, and specify each unique mailbox identity.

I’ll use the primary SMTP address as the unique mailbox identifier in this example. The result is shown in descending order by TotalMailboxSize.

Get-Mailbox -RecipientTypeDetails UserMailbox | ForEach-Object { Get-MailboxStatistics $_.PrimarySmtpAddress.ToString() } | Sort-Object TotalItemSize -Descending | Select-Object DisplayName, TotalItemSize

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (13)

Get Mailbox Last Logged On Information

Finding out which mailboxes have been inactive is one way to help with housekeeping. Building upon the previous example, we can pipe the Get-Mailbox results to Get-MailboxStatistics to determine when the mailboxes were accessed and calculate how many days since.

Get-Mailbox -RecipientTypeDetails UserMailbox |ForEach-Object { Get-MailboxStatistics $_.PrimarySmtpAddress.ToString() } |Sort-Object LastLogonTime -Descending |Select-Object DisplayName, LastLogonTime, @{n="DaysSinceLastLogOn";e={(New-TimeSpan -Start $_.LastLogonTime -End (Get-Date)).Days}}

The output is sorted by LastLogonTime, starting from the most recent.

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (14)

Get Mailbox with Full Access Permissions

If you’re wondering which of your users has full access to other mailboxes, you can pipe the Get-Mailbox results to the Get-MailboxPermission cmdlet.

$fullAccessPermission = Get-Mailbox -ResultSize Unlimited |ForEach-Object { Get-MailboxPermission -Identity $_.PrimarySmtpAddress.ToString() } |Where-Object { $_.AccessRights -Contains "FullAccess" }$fullAccessPermission | Format-Table Identity, User

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (15)

PowerShell Script to Get Mailbox Storage Quota Status

In pre-Exchange Server 2013, the Information Store caches the StorageLimitStatus property that determines whether the mailbox storage usage (quota) status is normal, warning, sending disabled, and send/receive disabled.

There’s no straightforward method to get the mailbox storage quota status beginning in Exchange 2013 and Exchange Online. Lucky for you, we’ve created a PowerShell function that you can conveniently use to report the mailbox quota status.

You can get the script from this repository →: GetMailboxQuotaStatus. Import the function into your PowerShell session by dot-sourcing or pasting the code directly.

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (16)

Get the Quota Status of All Mailboxes

To get the quota status of all mailboxes, run this command.

Get-Mailbox -ResultSize Unlimited | Get-QuotaStatus

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (17)

Get the Quota Status of One or More Mailboxes

This example gets the mailbox quota status of one mailbox.

# Using the pipeline inputGet-Mailbox <identity> | Get-QuotaStatus# Using the parameter inputGet-QuotaStatus -Mailbox (Get-Mailbox <identity>)Get-QuotaStatus -Mailbox <email@domain.com>,<Alias>,<SamAccountName>

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (18)

Conclusion

The Get-Mailbox cmdlet is an indispensable tool in an Exchange Administrator toolbox. It may be a simple command, but it can be used to get basic and complex information about Exchange Server or Exchange Online mailboxes.

ExchangeOffice 365

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (19)

Cyril Kardashevsky

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.

Using Get-MailBox to View Mailbox Details in Exchange and Microsoft 365 – TheITBros (2024)
Top Articles
How to Make Slime - 3 Ingredient Recipe
How to Make Fluffy Slime: Easy 3 Ingredient Recipe
Where To Go After Howling Pit Code Vein
AMC Theatre - Rent A Private Theatre (Up to 20 Guests) From $99+ (Select Theaters)
Encore Atlanta Cheer Competition
What spices do Germans cook with?
Practical Magic 123Movies
Robot or human?
Fort Carson Cif Phone Number
Southside Grill Schuylkill Haven Pa
Hotels Near 500 W Sunshine St Springfield Mo 65807
Corpse Bride Soap2Day
Fallout 4 Pipboy Upgrades
Hillside Funeral Home Washington Nc Obituaries
Discover Westchester's Top Towns — And What Makes Them So Unique
6001 Canadian Ct Orlando Fl
065106619
All Obituaries | Buie's Funeral Home | Raeford NC funeral home and cremation
Bank Of America Financial Center Irvington Photos
Effingham Bookings Florence Sc
/Www.usps.com/International/Passports.htm
Invitation Homes plans to spend $1 billion buying houses in an already overheated market. Here's its presentation to investors setting out its playbook.
BMW K1600GT (2017-on) Review | Speed, Specs & Prices
Riversweeps Admin Login
Happy Homebodies Breakup
California Online Traffic School
Skycurve Replacement Mat
Feathers
Himekishi Ga Classmate Raw
Warn Notice Va
Nicole Wallace Mother Of Pearl Necklace
Lil Durk's Brother DThang Killed in Harvey, Illinois, ME Confirms
Babbychula
2008 Chevrolet Corvette for sale - Houston, TX - craigslist
Collier Urgent Care Park Shore
Ursula Creed Datasheet
The disadvantages of patient portals
Marcus Roberts 1040 Answers
Main Street Station Coshocton Menu
Albertville Memorial Funeral Home Obituaries
Tsbarbiespanishxxl
Achieving and Maintaining 10% Body Fat
Grand Valley State University Library Hours
R/Gnv
Adams-Buggs Funeral Services Obituaries
5103 Liberty Ave, North Bergen, NJ 07047 - MLS 240018284 - Coldwell Banker
Tito Jackson, member of beloved pop group the Jackson 5, dies at 70
F9 2385
Houston Primary Care Byron Ga
Karen Kripas Obituary
Adams County 911 Live Incident
Asisn Massage Near Me
Latest Posts
Article information

Author: Twana Towne Ret

Last Updated:

Views: 5913

Rating: 4.3 / 5 (64 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Twana Towne Ret

Birthday: 1994-03-19

Address: Apt. 990 97439 Corwin Motorway, Port Eliseoburgh, NM 99144-2618

Phone: +5958753152963

Job: National Specialist

Hobby: Kayaking, Photography, Skydiving, Embroidery, Leather crafting, Orienteering, Cooking

Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.