Get Shared Mailbox in Office 365 using PowerShell 

Often Microsoft 365 admins in situations to get all list of shared mailboxes in their Exchange Online environment. Even with a simple cmdlet, you can list the shared mailboxes. For example, 

Before using the above cmdlet, you must connect to Exchange Online PowerShell. But the result will not be as you expected. To ease your work, we have created a PowerShell script. It will export shared mailbox reports to CSV with the most required attributes. 


Script Download: GetSharedMailboxReport.ps1 


Script Highlights: 

  • The script uses modern authentication to connect to Exchange Online.    
  • The script can be executed with an MFA-enabled account too.    
  • Exports report results to CSV file.    
  • It helps to identify shared mailboxes with licenses separately.  
  • Helps to track email forwarding configured shared mailboxes. 
  • Automatically installs the EXO V2 module (if not installed already) upon your confirmation.   
  • The script is scheduler-friendly. I.e., Credentials can be passed as a parameter instead of getting interactively. 


Export Office 365 Shared Mailboxes Report – Sample Output: 

The exported shared mailbox details report will contain the following attributes: 

Mailbox name, Primary SMTP address, Alias, Shared mailbox size, License status, Archive status, Hide from address list, Audit enabled, Forwarding address, Forwarding SMTP address, Litigation hold status, Retention hold status.

get shared mailboxes in Office 365 using PowerShell


Script Execution Methods: 

To run this script, you can choose any of the methods below.   

Method 1: To run the script with an MFA and non-MFA accounts, 

The exported report will contain all the shared mailboxes in Office 365 and their properties to CSV file.


Method 2: To schedule the script using the non-MFA account, 

If the admin account has MFA, you must disable MFA using the Conditional Access policy to make the script work.


Method 3: To find shared mailboxes with licenses, execute the script with the –LicensedOnly switch parameter. 

You can download our dedicated script on licensed shared mailbox report to get more detailed shared mailboxes with licenses. 


Method 4: To identify shared mailboxes with auto-email forwarding configurations, run the script with –EmailForwardingEnabled switch param. 



How to Get Shared Mailbox Members and Permissions: 

To get shared mailbox members and shared mailbox Send As/Send On Behalf permissions, you can generate the shared mailbox permission report

Sample Output: 

Shared Mailbox Permission Report


I hope this blog will you get reports on shared mailboxes. If you have any queries or need enhancements to the script, you can reach us through the comment section.