This is going to be an extremely short post about custom attribute before we move to the distribution group. A custom attribute is an attribute that you add to the mailbox that suits your need. Do you remember the schema extension that many Microsoft products do like SCCM? Typically when you install SCCM it extends the schema of Active directory so that SCCM can save some of its custom work inside active directory which the people have not thought off before defining the the active directory.
Lets take an example- Consider in a school; all the students are divided into houses for an sports activity named as Green, Yellow, Blue and Red. A house contains students from all the classes. So if someone wants to send an email to a particular house say green, its sort of a challenging tasks because students keep on moving out from school and there are mid year admissions as well so manually maintaining a distribution list would be somewhat tedious. So what we do is to define a custom attribute to that all the mailbox. I have a set of 15 attributes that i can define with exchange. So lets say we will use attribute 3 and set it as the house name.
Set-Mailbox -Identity "susan sanders" -CustomAttribute3 "Yellow"
I can confirm that this is indeed working by running the following command:
[PS] C:\Windows\system32>Set-Mailbox -Identity "susan sanders" -CustomAttribute3 "Yellow"
WARNING: The command completed successfully but no settings of 'mayanks.ga/Users/Susan Sanders' have been modified.
[PS] C:\Windows\system32>Get-Mailbox -Identity "susan sanders" |fl CustomAttribute3
CustomAttribute3 : Yellow
Imagine how useful it is, next time if anyone wants to send an email to everyone in yellow team, they can just send an email to distribution group by using a criteria. You can create a dynamic group.
New-DynamicDistributionGroup -Name "The Yellow Group" -IncludedRecipients "MailboxUsers,MailContacts" -ConditionalCustomAttribute3 "Yellow"
Do remember attributes are case insensitive, i.e. 'Yellow', 'yellow' and 'yElloW' are all the same. If you want to confirm that all the intended users are added in the group, there are couple of happy go lucky commandlets available for this..
$Yellow = Get-DynamicDistributionGroup "Yellow Group"
Get-Recipient -RecipientPreviewFilter $yellow.RecipientFilter
output will be something like this:
Susan Sanders UserMailbox
Thank you for reading and until next time!