Following on from my previous post detailing the options for sending mass mails, I thought it would be useful to post the PowerShell code I’ve used in the past to create, and test, DDGs.
DDGs, rather than store a set list of recipients, will mail users who satisfy the criteria upon which the group is based. There are a variety of attributes you can use, such as CustomAttributeX (where X is a number 1 to 15). I’ve included some sample steps:
1. Create new dynamic distribution group:
New-DynamicDistributionGroup "All Parents" -IncludedRecipients MailboxUsers, MailContacts –ConditionalCustomAttribute1 Parent
This code creates a new DDG called “All Parents” (AllParents@your-domain.ac.uk) and includes your mailbox users and external contacts in the search on CustomAttribute1, which in this case looks for “Parent”.
2. Test DDG criteria:
$DDG = Get-DynamicDistributionGroup "All Parents"; Get-Recipient -RecipientPreviewFilter $DDG.RecipientFilter
This code will display all the users the DDG would mail if you were to send a message to it. You should see all users who have “Parent” in CustomAttribute1 listed.
It is important to consider setting restrictions on who can mail the DDG – by default it cannot be mailed from outside of your Outlook Live domain; however unless you specifically set it your DDG will be visible in the GAL and “mailable” by all your users.
For information on hiding and moderating your DDGs, read part 2!
Leave a Reply