Display Name can be same but email addresses cannot be the same for everyone.
I've got the command to get the list of UserName, EmailAddress of the members/users (Internal,External) those are having the permission to send the email to the group. But I couldn't find how to get the DistributionGroup Name & EmailAddress.
I am getting details of only users/members those are having permission to send the email to the specific group via below command
(Get-DistributionGroup -ResultSize Unlimited).acceptmessagesonlyfrom | Get-User | Select-Object DisplayName,userprincipalname,title, windowsemailaddress
Can anyone help me to get the output for users/members those are having permission to send the emails to DG & Unified Group in below format
DG Name DG Email MemberDisplayName MemberUserPrincipalName MemberWindowsEmailAddress
2 Different commands will be fine at this moment but if anyone has a expertise in PSS then i don't mind trying on my Tenant to see the output
Below command gives me output for the DG's has someone who has a permission to send the email to
Get-DistributionGroup -ResultSize Unlimited -filter {(AcceptMessagesOnlyFrom -ne $null) -or (AcceptMessagesOnlyFromDLMembers -ne $null) } | select-object PrimarySMTPAddress,@{Name="AcceptMessagesOnlyFrom";Expression={[string]::join(";",($.AcceptMessagesOnlyFromSendersOrMembers | foreach {Split-Path $ -Leaf}) )}}
Anyones little help will be appreciated