Listing shared mailboxes and members - Powershell

Copper Contributor

Hi,

Does anyone knows how to get a list of shared mailboxes and members with powershell?

Thanks in advance,

Regards

23 Replies

The following should work for you:

 

Get-Mailbox -Filter {recipienttypedetails -eq "SharedMailbox"}

Hi Jeremy,

Thanks for your answer but what i get with this command does not shows members of shared mailboxes:

Name                      Alias           Database                       ProhibitSendQuota    ExternalDirectoryObjectI
                                                                                              d                      
----                      -----           --------                       -----------------    ------------------------
Leioandi2 Homes           leioandi2.homes EURPR09DG154-db059             99 GB (106,300,44... 5c2b2147-3d01-41ce-be...
solicitudcontratos        solicitudcon... EURPR09DG045-db096             49.5 GB (53,150,2... 452ac29d-4de9-4305-b4...
pp.sur                    pp.sur          EURPR09DG130-db023             49.5 GB (53,150,2... af168196-d119-4675-8b...

Shared mailboxes don't have "members", perhaps you mean a report of users that have been granted Full Access permissions to the shared mailbox? If so, try this script: https://gallery.technet.microsoft.com/Office-365-Mailbox-c2adf0db?redir=0

Hi,
As far as i know, MS call them “members”. You can see it here: https://support.office.com/en-us/article/add-or-remove-members-from-a-shared-mailbox-a1cd0ae0-216c-4...
And every other MS sites.
However, i’ll see the link you provide and let you know.
Thanks.
The link you provided don’t talk about shared mailboxes but simple mailboxes permisions
Thanks anyway

If you are just looking for a quick and dirty list, this may help.  Otherwise the script that Vasil pointed you to should also work.

 

Get-Mailbox -Filter {recipienttypedetails -eq "SharedMailbox"} | Get-Mailboxpermission

Hi Jeremy,

This Will be enough for me, if i reach to format results.

Thanks.

Regards,

 

Here is the powershell to get this 

 

Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Get-MailboxPermission | select identity,user,accessrights  | where { ($_.User -like '*@*')   }

@Paris Wells wrote:

Here is the powershell to get this 

 

Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Get-MailboxPermission | select identity,user,accessrights  | where { ($_.User -like '*@*')   }


Can you add a way to export the result to an Excel file. Would really appreciate it. Thanks! 

Thanks for the script. Can i get a list of send as permissions too along with accessrights?

You can see sendas permissions using the Get-RecipientPermission cmdlet.

thanks it worked.

Get-RecipientPermission -Identity "mailbox" -AccessRights sendas | where {($_.trustee -like '*@*') }

What I do is sending the results to a txt file, just adding :

>myfilename.txt 

at the end of the sentence.

You can pipe the result to a csv file Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Get-MailboxPermission | select identity,user,accessrights | where { ($_.User -like '*@*') } | Export-Csv -path -NoTypeInformation more info bout export-csv can be found here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-csv?view=powe...

@Paris Wells Just wanted to say thank you! This worked perfectly. Piped it to Export-CSV, turned that into an XLSX and off to management it goes for review.

Thanks!

@Neeraj Ail 

I hope this will help you.
https://o365reports.com/2020/01/03/shared-mailbox-permission-report-to-csv/

This script exports shared mailbox permissions like full access, send as and send on behalf to CSV file.

@Paris Wells  Thanks Buddy, its working good!! \you help me a lot! 

How to Get a List of Shared Mailboxes Members and Permissions
Connect to Office 365 PowerShell, run the PowerShell ISE as Administrator and execute the following command: ...
Type your user ID and password in the Windows PowerShell Credential Request and click OK.

@Neeraj Ail It worked perfectly. Thank you!!!