Powershell to list accounts of shared mailboxes

In Exchange if you right click a mailbox and select "Manage Full Access Permission" it will show a list of who has access to that particular mailbox. I need a powershell script that list these accounts/mailboxes. Is there a way to do this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohammad Mahboob RahmatiSr . IT System Administration EngineerCommented:
To Display all of the existing Shared Mailboxes

1 - Get-Mailbox <Identity> -RecipientTypeDetails SharedMailbox

Adjustments & Customizations | Remove unnecessary fields from the output

2 -Get-Mailbox <Identity> -RecipientTypeDetails SharedMailbox | Select Alias

or if you want to check the list of shared Mailboxes with Access Permission use below command.

Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox | Get-MailboxPermission | ? {$_.User -ne "NT AUTHORITY\SELF" -and $_.IsInherited -ne $true -and $_.user -notlike "S-1-5-*" -and $_.AccessRights -eq "FullAccess"} | ft Identity,@{n="User";e={(get-user $_.user).userprincipalname}},AccessRights,IsInherited -AutoSize

for more info please check below link.

CiscoAznAuthor Commented:
Is there a way to run this on a particular OU first?
Jason CrawfordTransport NinjaCommented:
No sense in reinventing the wheel.  This one was provided by The Google:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.