exchange online powershell get mailbox

Master Exchange Online PowerShell: Get Mailbox Cmdlets Guide

By John Anderson
AD

Managing Exchange Online mailboxes efficiently often requires moving beyond the web interface, and leveraging the capabilities of Exchange Online PowerShell is essential for IT professionals. The command `Get-Mailbox` serves as a foundational tool, providing a comprehensive view of all mailboxes within your tenant. This cmdlet is not merely a list; it is a gateway to detailed inventory, compliance checks, and preparation for bulk administrative tasks.

Understanding the Core Get-Mailbox Cmdlet

At its simplest, running `Get-Mailbox` without parameters returns a basic list of all user mailboxes, room mailboxes, and equipment mailboxes available to your account. This output includes primary SMTP addresses and legacy exchange distinguished names, offering a quick snapshot of your environment. For more specific results, you can filter results using the `-Filter` parameter to target specific users, departments, or custom attributes, making it a powerful query instrument.

Retrieving Specific Mailbox Types

Not all mailboxes are created equal, and the cmdlet allows for granular filtering based on type. You can isolate user mailboxes with `Get-Mailbox -RecipientTypeDetails UserMailbox` or focus on resource mailboxes like rooms and equipment. This level of specificity is critical when you are tasked with auditing license allocations or managing resources in a large enterprise environment.

AD
Microsoft Issues Urgent Warning Over Local Exchange Online Mailbox Moves
Microsoft Issues Urgent Warning Over Local Exchange Online Mailbox Moves
Manage Send As Permissions using PowerShell
Manage Send As Permissions using PowerShell
PowerShell — Get All Users in an Active Directory Group (2026)
PowerShell — Get All Users in an Active Directory Group (2026)

Extending Functionality with Parameters

To move beyond basic identification, you utilize the `Select-Object` cmdlet to choose specific properties for your output. Properties such as `DisplayName`, `PrimarySmtpAddress`, `IsLicensed`, and `WhenCreated` provide context for administration. Combining these with `Get-Mailbox` allows you to generate reports that align directly with your organizational requirements.

Parameter Description Example Usage
-Filter Applies a query to narrow results based on Active Directory attributes. Get-Mailbox -Filter {Department -eq "Sales"}
-ResultSize Limits the number of results returned, useful for large directories. Get-Mailbox -ResultSize 100
-OrganizationalUnit Restricts the search to a specific OU structure. Get-Mailbox -OrganizationalUnit "Contoso.com/Users"

Connecting to Exchange Online

Before executing these commands, you must establish a remote session. This involves importing the `ExchangeOnlineManagement` module and using `Connect-ExchangeOnline` with appropriate credentials. Modern authentication methods ensure that your session is secure and compliant with current security standards, preventing the use of legacy protocols where possible.

How to Export Archive Exchange Mailbox To PST
How to Export Archive Exchange Mailbox To PST
How to Send an Email Using Windows PowerShell
How to Send an Email Using Windows PowerShell
Uninstall-package Not Working: How to Force it
Uninstall-package Not Working: How to Force it

Troubleshooting Common Connection Issues

Occasionally, execution policies or multi-factor authentication can block the connection. Setting the execution policy to `RemoteSigned` locally often resolves script blocking errors. If MFA prompts fail, ensuring that your account has the necessary admin roles assigned in the Azure AD portal is the next logical step.

Leveraging Output for Administration

The data retrieved is not just for viewing; it is the starting point for automation. You can pipe the results of `Get-Mailbox` directly into other cmdlets to execute bulk updates. For instance, identifying mailboxes older than a specific date allows you to apply retention policies or prepare for decommissioning efficiently.

AD

Mastery of this command ensures that you maintain control and visibility over your messaging environment, reducing manual overhead and potential for error. Continuous monitoring and scripting with `Get-Mailbox` will streamline your Exchange Online management workflow significantly.

o365info
o365info
Adding Calendar Permissions in Microsoft 365 and Exchange with PowerShell
Adding Calendar Permissions in Microsoft 365 and Exchange with PowerShell
Kurzanleitung für die Börse | Online-Börse | Mischling | Nachrichtenfluss | IT 2013 | SysAdm
Kurzanleitung für die Börse | Online-Börse | Mischling | Nachrichtenfluss | IT 2013 | SysAdm
9 Top Virtual Mailbox Providers
9 Top Virtual Mailbox Providers
Smart Mailbox
Smart Mailbox
o365info
o365info
Virtual Mailbox Basics: How I Get Mail While I Travel Full-Time...
Virtual Mailbox Basics: How I Get Mail While I Travel Full-Time...
How to Purge or Delete a Disconnected Mailbox in Exchange 2007 - geekyprojects.com
How to Purge or Delete a Disconnected Mailbox in Exchange 2007 - geekyprojects.com
Get mailbox migration to Microsoft 365 with PowerShell
Get mailbox migration to Microsoft 365 with PowerShell
o365info
o365info
9 ways to open PowerShell in Windows (including as administrator)
9 ways to open PowerShell in Windows (including as administrator)
How to Recover deleted items from Microsoft 365 mailbox
How to Recover deleted items from Microsoft 365 mailbox
Microsoft says transport/DLP rule conflicts have forced it to pull Exchange Server update
Microsoft says transport/DLP rule conflicts have forced it to pull Exchange Server update
You won’t be able to receive mail from a current mailbox Outlook error
You won’t be able to receive mail from a current mailbox Outlook error
A mailbox couldn't be found for Office 365 [Fix]
A mailbox couldn't be found for Office 365 [Fix]
How to Recover deleted items from Microsoft 365 mailbox
How to Recover deleted items from Microsoft 365 mailbox
o365info
o365info
15 Creative Double Mailbox Post Ideas for Your Front Yard
15 Creative Double Mailbox Post Ideas for Your Front Yard
How to Create an Email Server in Linux with Mail-In-A-Box - Make Tech Easier
How to Create an Email Server in Linux with Mail-In-A-Box - Make Tech Easier
Mbox to PST Converter
Mbox to PST Converter
AD