List shared mailboxes and users with access to them


I need help with a script to list all shared mailboxes in Exchange 2010 SP2 organizations along with a list of users having access to that mailbox.
For example user1 delegated his mailbox to user3, user7, so the report will produce similar output "User1: User3, User7"

The format can be anything readable, does not have to be on a single line. I have searched for such scripts on EE< nothing worked for me. I need to run it on about 200 users most of them have shared their mailboxes with others.

Appreciate your help.
Who is Participating?
Justin YeungConnect With a Mentor Senior Systems EngineerCommented:

-Resultsize Unlimited



and before

| where-object

since by default limit is 1000 and you have more than 1000 mailboxes.

and in fact I think it is better to filter it before hand.
$Mailboxes = Get-Mailbox -Resultsize Unlimited -Filter {RecipientTypeDetails -eq "SharedMailbox"} 
foreach ($mailbox in $mailboxes)
Get-MailboxPermission $Mailbox.Name | ? {$_.AccessRights -like "*FullAccess*"} | Select-Object @{N="Mailbox Name";E={$Mailbox.Name}},User

Open in new window

 {RecipientTypeDetails -eq "SharedMailbox"}  = The Mailbox Attribute is SharedMailbox, if you have no sharedmailbox under your exchange, you will have no return.
petekdokuConnect With a Mentor Commented:

get-mailbox  | where-object {$_.recipienttypedetails -like "*shared*"} | get-mailboxpermi
ssion | where-object {$_.accessrights -like "*full*" } | ft identity, user

identity: the shared mailbox name.
user: full access to that shared mailbox.
CoffinatedAuthor Commented:

It does not print any results

[PS] C:\Users\Administrator\desktop>Get-Mailbox | Where-Object {$_.RecipientTypeDetails -like "*shared*"} | Get-MailboxPermission | Where-Object {$_.AccessRights -like "*full"} | ft identity,user
WARNING: By default, only the first 1000 items are returned. Use the ResultSize parameter to specify the number of items returned. To return all items, specify "-ResultSize Unlimited". Be aware that, depending on the actual number of items, returning all items can take a long time and consume a large amount of memory. Also, we don't recommend storing the results in a variable. Instead, pipe the results to another task or script to perform batch changes.
[PS] C:\Users\Administrator\desktop>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.