Allow an M365 User to send to multiple Restricted Groups and Dynamic DLs

Scenario

You have a new Executive or top level user that needs to be able to send emails to all distribution lists in the M365 Org, INCLUDING Restricted ones where only certain senders can communicate with the DL or Group. Not all groups are restricted and you need to only add them to the restricted groups and DLs. To know what groups have a restriction, you look for the AcceptMessagesOnlyFromSendersorMembers parameter when you get the DL properties.

I have created the following PowerShell commands that will allow you to accomplish this task successfully.

After connecting to Exchange Online PowerShell, review what DL and Dynamic DLs are restricted:

Do the same for Dynamic DLs:

Once those DLs are verified, we want to get the UPN of the user we want to add to the list. For this case we can use mynewuser01@ldlnet.net for this purpose.

In PowerShell, we want to pipe: ‘|’ multiple commands together so that we can accomplish the task with the list we just generated. We want to user the where ‘?’ parameter to filter the groups by the attribute, and then user the foreach ‘%’ statement so that we can add the user to each DL in the list. We are also going to use the array parameter ‘@{function=”data1″,”data2″,etc…}’ so that we can add multiple users if necessary for this function of add to add the user(s). If you wanted to remove the users, then change the add function to remove in the statement.

Here is the cmdlet:

Do the same for Dynamic DLs:

Conclusion

Exchange Online PowerShell provides many good tools to filter and complete tasks that might seem arduous when manually done in the GUI portal.

THANKS FOR READING!

REFERENCES:
How to add/remove allow sender of distribution group with – Microsoft Community

Get E-Mail Updates
I agree to have my personal information transfered to MailChimp ( more information )
Want to know when I post new content? Sign up here to get an email when I do post!
I despise spam. Your email address will not be sold or shared with anyone else.
css.php