List of all "shared or user mailboxes" that each user have FULL access to

In Exchange 2010 we got about 1500 users.
I need to find a way to make a list of all "shared or user mailboxes" that each user have FULL access to. I have an excel sheet with all SAM names that are ready to be imported, once i find a solution, and then I need to find a way to export results out to a new CSV.

Example:  Glen have access to Martin and Elen's user mailbox. Glen also have access to billing, reciepts, HR shared mailbox.

I found following command which does the job by inputting manually one user at a time, and also this command takes about 10 minutes to finally execute.

Get-Mailbox -resultsize "Unlimited" | Get-MailboxPermission | where { ($_.AccessRights -eq "FullAccess") -and ($_.User -like "domainname\username") -and ($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF") } | 
ft User, @{Name="Identity";expression={($_.Identity -split "/")[-1]}} -Autosize

Open in new window

Can any one know or help me with this work, I tried researching online but could not find straight forward solution.

Nick PerksIT DirectorAsked:
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.

Veerappan SundaramSenior Technical ConsultantCommented:
Store the data you have in CSV format with Samaccountname.

$Mailboxes = import-csv C:\temp\sam.csv
$Mailboxes | foreach {Get-MailboxPermission | where { ($_.AccessRights -eq "FullAccess") -and ($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF") } }| select Identity,user
Nick PerksIT DirectorAuthor Commented:
@Veerapan, Using this method makes it very slow process to get the data out, it could take hours and hours if we have 1500 employees.
And if I am not mistaken, your script is trying to get all mailboxes name that have access to User A mailbox ?   I want the other way round.

Is there no easy way in exchange to simply find out via a command that:  User A have Full access to these 4 mailboxes  and display me the name of those mailboxes ?

If there is such command, then this data fetch across the company can be much quicker and we can figure out formatting of output to a csv after.

Any Exchange expert, Please let me know.

Thanks very much.
timgreen7077Exchange EngineerCommented:
If you are attempting to find out the results for 1 user say for instance user A then run the below:

Get-mailbox -Resultsize Unlimited | Get-mailboxpermission -User "UserName" | ft identity, AccessRights

This will show you the results just for mailboxes user A has full manage access to.
Discover the Answer to Productive IT

Discover app within WatchGuard's Wi-Fi Cloud helps you optimize W-Fi user experience with the most complete set of visibility, troubleshooting, and network health features. Quickly pinpointing network problems will lead to more happy users and most importantly, productive IT.

Nick PerksIT DirectorAuthor Commented:
@thanks TimGreen. That is command is working to show Access rights for the user.

How to narrow results down to only Full access mailboxes.

Now can anyone help me make this in a loop if I have list of SAM names csv, How to import it into a list and then export this result out to a new csv. csv should show the user A in question and on the other columns list of mailboxes that he has access to.

Thanks in advance!
timgreen7077Exchange EngineerCommented:
This will export the results for user A to a csv file

$mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mailbox in $mailboxes){
$perms += @(Get-MailboxPermission -Identity $mailbox.Alias -User "username")
$perms | select identity, accessrights | export-csv c:\temp\results.csv
Veerappan SundaramSenior Technical ConsultantCommented:
Got it.

Here is a very simple and faster method.

From Exchange Management Shell,
  Import-Module ActiveDirectory
  Get-Aduser -Identity samaccountname -Properties msExchDelegateListBL | select -expandproperty msExchDelegateListBL

This is for single user - it gives results very fast.
I need to try this in ForEach loop.
Veerappan SundaramSenior Technical ConsultantCommented:
below command helps to get the data, but needs little more formatting.

Get-ADUser -Properties msExchDelegateListBL -LDAPFilter "(msExchDelegateListBL=*)" | select samaccountname,@{l="Users";e={[string]::join(";",($_.msExchDelegateListBL))}} | export-csv c:\temp\mbxperm.csv

once you get the data in CSV format, you need to open in it Microsoft Excel and use "Text to Column" against Users column.

I'm not an expert in Powershell, trying to get this more simplified.
Veerappan SundaramSenior Technical ConsultantCommented:
Try this

Get-ADUser -LDAPFilter "(msExchDelegateListBL=*)" -Properties msExchDelegateListBL  | select name,samaccountname,@{L="Mailboxes";e={($_.msExchDelegateListBL | foreach {(Get-ADobject $_).name }) -Join ";"}} | export-csv c:\temp\mbxperm.csv

This gives,
 Column A = Name of the user
Column B = SamaccountName of the user
Column C = Mailbox Names where the user has Full Access

In Excel, you need to use "Text to Cloumns" for Column C.

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
Nick PerksIT DirectorAuthor Commented:
I just want to thank Veerapan to try his best to help me out multiple times and finally getting to what I want. This PS command was most effective and quick in producing results compared to trying with number of time consuming loops etc. Thank you once again my friend!!!
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.