export shared mailbox members to csv powershell

"Export Shared Mailbox Members to CSV via PowerShell"

By William Johnson
AD

Are you looking to export the members of a shared mailbox to a CSV file using PowerShell? You're in the right place. In this guide, we'll walk you through a step-by-step process to achieve this, making it easy for you to manage and analyze your shared mailbox members.

Understanding Shared Mailbox Members

Shared mailboxes in Exchange Online or on-premises allow multiple users to access and send emails from a single mailbox. Managing these members can be simplified by exporting them to a CSV file. This can help you keep track of who has access, make changes, or even restore access if needed.

Before You Start

Before you begin, ensure you have the necessary permissions to access the shared mailbox and export its members. You'll also need to have PowerShell and the Exchange Online PowerShell V2 module installed.

AD
9 Top Virtual Mailbox Providers
9 Top Virtual Mailbox Providers
PO Box vs Virtual Mailbox – Why you might want one and how to get one!
PO Box vs Virtual Mailbox – Why you might want one and how to get one!
How to Export Your Outlook Contacts to CSV
How to Export Your Outlook Contacts to CSV

Install the Exchange Online PowerShell V2 Module

If you haven't already, install the Exchange Online PowerShell V2 module by running the following command in PowerShell:

Install-Module -Name ExchangeOnlineManagement

the back end of a van filled with boxes
the back end of a van filled with boxes
25 K Mail access base(fr,de) 100% private - Combo List - Combolist
25 K Mail access base(fr,de) 100% private - Combo List - Combolist
an image of a computer screen with some text on it
an image of a computer screen with some text on it

Connect to Exchange Online PowerShell

After installation, connect to Exchange Online PowerShell using your admin credentials. Run the following command:

Connect-ExchangeOnline -UserPrincipalName admin@example.com

AD

Replace admin@example.com with your admin email address.

Brass Coated Mail Slot, Mailboxes In A Building, Mail Room, Brass Mailbox Slot, Mailbox Rental Business, Apartment Mailbox, Apartment Mailbox Setup Tips, Church Mailbox System, Community Mailboxes
Brass Coated Mail Slot, Mailboxes In A Building, Mail Room, Brass Mailbox Slot, Mailbox Rental Business, Apartment Mailbox, Apartment Mailbox Setup Tips, Church Mailbox System, Community Mailboxes
The 2019 Guide to Achieving Inbox Zero Outlook | Step-by-step Guide
The 2019 Guide to Achieving Inbox Zero Outlook | Step-by-step Guide
a letter from fed ex to the company
a letter from fed ex to the company
three mailboxes in front of a large house
three mailboxes in front of a large house
the front desk of an office with many different items on display in boxes and bins
the front desk of an office with many different items on display in boxes and bins
Simple MBOX to PST Converter – Convert MBOX Files in Minutes
Simple MBOX to PST Converter – Convert MBOX Files in Minutes

Export Shared Mailbox Members to CSV

Now, let's export the members of a shared mailbox to a CSV file. Here's a script that does just that:

```powershell # Replace 'sharedmailbox@example.com' with the shared mailbox you want to export $sharedMailbox = 'sharedmailbox@example.com' # Get the members of the shared mailbox $members = Get-MailboxPermission -Identity $sharedMailbox -ErrorAction SilentlyContinue # Filter out the default permissions and only keep user permissions $filteredMembers = $members | Where-Object { $_.User -ne $null -and $_.User -notlike 'NT AUTHORITY\*' } # Select the required properties and export to CSV $filteredMembers | Select-Object User, AccessRights, AutoMapping | Export-Csv -Path "C:\temp\SharedMailboxMembers.csv" -NoTypeInformation ```

Understanding the Script

  • $sharedMailbox: Replace this with the shared mailbox you want to export.
  • Get-MailboxPermission: This cmdlet retrieves the permissions for the shared mailbox.
  • Where-Object: This filters out the default permissions and only keeps user permissions.
  • Select-Object: This selects the required properties (User, AccessRights, AutoMapping) to export.
  • Export-Csv: This exports the selected properties to a CSV file at the specified path.

Verifying the Export

After running the script, you should see a new file named SharedMailboxMembers.csv in the specified path (C:\temp in this example). Open this file to verify that the members of the shared mailbox have been exported correctly.

AD

Disconnecting from Exchange Online PowerShell

Once you're done, don't forget to disconnect from Exchange Online PowerShell by running:

13 Best Mailbox Ideas
13 Best Mailbox Ideas
a postal mail box with the priority mail sticker on it's back side
a postal mail box with the priority mail sticker on it's back side
Tips to Unlocking the Full-Time RV Dream | Life in The RV
Tips to Unlocking the Full-Time RV Dream | Life in The RV
a bunch of boxes that are on top of a wooden bench in the grass near some trees
a bunch of boxes that are on top of a wooden bench in the grass near some trees
two white envelopes sitting on top of a table
two white envelopes sitting on top of a table
a man standing in front of a mailbox with his hand on the box and looking at it
a man standing in front of a mailbox with his hand on the box and looking at it
there are many mail boxes in the grass
there are many mail boxes in the grass
a document with an image of the company's logo on it
a document with an image of the company's logo on it
a blue mailbox sitting on the side of a street
a blue mailbox sitting on the side of a street
Pony Express, Rural Mailbox Regulations, Installing A Wall-mounted Mailbox, U.s. Mail Box Dimensions, Us Mailbox, Mailbox With Farm Sign
Pony Express, Rural Mailbox Regulations, Installing A Wall-mounted Mailbox, U.s. Mail Box Dimensions, Us Mailbox, Mailbox With Farm Sign
How to Organize Your Outlook Email Inbox Efficiently | Envato Tuts+
How to Organize Your Outlook Email Inbox Efficiently | Envato Tuts+
a screen shot of a mailbox on the side of a road with several photos showing it
a screen shot of a mailbox on the side of a road with several photos showing it
the mailbox rental flyer is red and white
the mailbox rental flyer is red and white
PO Box Vs Private Mailboxes
PO Box Vs Private Mailboxes

Disconnect-ExchangeOnline

That's it! You've successfully exported the members of a shared mailbox to a CSV file using PowerShell. This can help you manage your shared mailboxes more efficiently and keep track of who has access to them.

AD
AD