Forum Discussion
eg0nzalez
Mar 25, 2022Copper Contributor
Need assistance creating Dynamic Distro Groups - Exchange - Office365
I need to create 100 new Dynamic Distro Groups. And, I'm a bit unsure of what my current .ps script will do.
Include all 50 states including three Custom Attributes:
- Custom Attribute1: users state - AL
- Custom Attribute2: users active status - true or false
- Custom Attribute3: user workerSubType - Regular or Contingent
Current draft:
New-DynamicDistributionGroup -Name "_All Florida Employees" -DisplayName "_All Florida Employees" -RecipientFilter "(RecipientType -eq 'UserMailbox')" -PrimarySmtpAddress "Email address removed"
-ConditionalCustomAttribute3 "FL" -ConditionalCustomAttribute7 "true" -ConditionalCustomAttribute8 "Regular"
I'd greatly appreciate any guidance I can get and what needs to change before I kick this off.
Thank you
- As the documentation explains, you can't use any Conditional parameters in combination with the RecipientFilter one. So best combine all of the required checks within the recipient filter. Something like:
New-DynamicDistributionGroup -Name "_All Florida Employees" -DisplayName "_All Florida Employees" -RecipientFilter "((RecipientType -eq 'UserMailbox') -and (CustomAttribute3 -eq "FL") -and (CustomAttribute7 -eq "true") -and (CustomAttribute8 -eq "Regular")) -PrimarySmtpAddress "Email address removed"- eg0nzalezCopper Contributor
VasilMichev I should have responded to this post two days ago. But I was able to figure it out. I appreciate the explanation.