Link to home
Start Free TrialLog in
Avatar of N B
N BFlag for Canada

asked on

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.

Thanks!
Avatar of Veerappan Sundaram
Veerappan Sundaram
Flag of India image

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
Avatar of N B

ASKER

@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.
Avatar of timgreen7077
timgreen7077

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.
Avatar of N B

ASKER

@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!
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
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Veerappan Sundaram
Veerappan Sundaram
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of N B

ASKER

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