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?
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.
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.
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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.
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.
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!!!
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.