Listing "send as", "send on behalf" and "Full access" permission for list of mail enabled AD users.

Hi Support,

We have a excel sheet with approx 300 users with below information:-
1) username 2) NTlogin 3) Full name 4) email address.

Many of the user accounts are assigned with "send as", "send on behalf" and "Full access" permission in exchange. Is it possible to export these permissions for each respective users in a CSV or XLS format.

We are using Exchange 2013 CU8.
TJOSYAsked:
Who is Participating?

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

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

David SankovskySenior SysAdminCommented:
Your question is ambiguous,
Are you trying to know how can send on behalf of the listed mailbox?
or what permissions does the username in question has over other mailboxes?
TJOSYAuthor Commented:
You are right. my requirement is to have the details of users who have "send on behalf", "full permission" and "send as" (if permission assigned) permission on each mailbox listed in the excel sheet. it is not necessary that all user have this delegated permission, but to list those mailbox which is delegated to other users.

Please note, im able to extract this information for one user, however my requirement is to have it available for list of users.

attached the sample format in XLS. I have marked cells in YELLOW for expected results.
delegate-permission.xlsx
Will SzymkowskiSenior Solution ArchitectCommented:
The below script should do this for you. I have tested this with a couple users and the output is correct.

You need to constrcut your CSV with only the following

Username = samaccountname
NTLogin = samaccountname
FullName = DisplayName
Email = Email

CSV should be constructed like below....
NOTE: make sure that you do not have any spaces in your column headings

Username   NTLogin  FullName,              Email
wills              wills         Will Szymkowski   wills@domain.com
etc...

$Output "c:\Results.csv"
$Users = Import-Csv "c:\filename.csv"

ForEach ($User in $Users) 
    {

    $User.Username
    $User.FullName
    $User.NTLogin
    $User.Email

      $Domain = "DomainHere\"

      $GETNAME = Get-mailbox -Identity $User.Email

      $ADSendAs = Get-Mailbox -ResultSize "unlimited" | Get-ADPermission | ? { ($_.ExtendedRights -like "Send-As") -and ($_.User -like $Domain+$User.Username) }

      $EXFull = Get-Mailbox -ResultSize "unlimited" | Get-MailboxPermission | ? { ($_.AccessRights -eq "FullAccess") -and ($_.User -like $Domain+$User.Username) }

      $EXSendBehalf = Get-Mailbox -ResultSize "unlimited" | select -ExpandProperty GrantSendOnBehalfTo | ? { ($_.Name -like "$GETNAME.DisplayName") }

                
                $Data = @{"Full Name"=$User.FullName;
                          "NT Login ID"=$User.NTLogin;
                          "Email"=$User.Email;
                          "Mailbox"=$EXFull.Identity;
                          "SendAsPerm"=$ADSendAs.User;
                          "FullAccess"=$EXFull.User;
                          "SendOnBehalf"=$EXSendBehalf.Name;
                         }

                $Obj = New-Object -TypeName PSObject -Property $Data

                $Obj | Export-Csv $Output -NTI -Append
                          
}

Open in new window



Will.

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
TJOSYAuthor Commented:
Thank you..  Also I got below script which will help us to export the results directly without source csv file..

for EXPORTING Full mailbox permission:
Get-Mailbox -OrganizationalUnit “<OU path>” | Get-MailboxPermission | where { ($_.AccessRights -eq “FullAccess”) -and ($_.IsInherited -eq $false) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | Export-Csv -path C:\TEMP\exch.csv –NoTypeInformation

for EXPORTING send as permission:
Get-Mailbox -OrganizationalUnit “<OU path>” -ResultSize unlimited | Get-ADPermission | Where {$_.ExtendedRights -like “Send-As” -and $_.User -notlike “NT AUTHORITY\SELF” -and $_.Deny -eq $false} | Export-Csv -path C:\TEMP\sendas.csv –NoTypeInformation
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
Exchange

From novice to tech pro — start learning today.