script to identify any explicit permissions assigned to distribution lists.

claudiamcse
claudiamcse used Ask the Experts™
on
Hello,
i am looking for a script to identify any explicit permissions assigned to distribution lists.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
What permissions are you looking for? SendAs/Send on behalf can be easily obtained:

$DGs = Get-DistributionGroup -ResultSize Unlimited

#For Send As permissions
$DGs | % {Get-RecipientPermission -Identity $_.Identity}

#For Send on Behalf permissions
$DGs | ? {$_.GrantSendOnBehalfTo -ne ""} | ft Name,DisplayName,PrimarySmtpAddress,GrantSendOnBehalfTo

Open in new window


Oh, and this will work for Exchange Online PowerShell only.

Author

Commented:
Oh. This actually didn't work....will try again
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
Again, this will only work in EO PowerShell:

PS C:\> $DGs = Get-DistributionGroup -ResultSize Unlimited
PS C:\> $DGs | % {Get-RecipientPermission -Identity $_.Identity}

Identity                            Trustee                             AccessControlType                   AccessRights                        Inherited
--------                            -------                             -----------------                   ------------                        ---------
TestDG                              vasil                      Allow                               {SendAs}                            False

PS C:\> $DGs | ? {$_.GrantSendOnBehalfTo -ne ""} | ft Name,DisplayName,PrimarySmtpAddress,GrantSendOnBehalfTo

Name                                         DisplayName                                  PrimarySmtpAddress                           GrantSendOnBehalfTo
----                                         -----------                                  ------------------                           -------------------
TestDG                                       TestDG                                       TestDG@domain.com                            {vasil}

Open in new window



 If you run it from the EMS, you will need different cmdlets

Author

Commented:
thanks!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial