Always Hot Café has three coffee shops in three different cities: New York, Los Angeles and Austin.
They asked IT to create a distribution list for all three, keeping in mind that staff move around and whenever one person is relocated, the distribution lists should be amended as well to mirror the actual situation.
IT has two choices: create three distribution lists with the right users, but that case wherever they are relocated, the distribution lists need to be manually updated.
The second option is for this exact same situation: creating a dynamic distribution groups, that will automatically maintain their membership lists based on pre-defined criteria.
Example
Here we know that the "City" property for each user is always up-to-date, so we simply create groups where the members are filtered based on the City property. Note that the filter will only contain the user accounts that are inside the "AlwaysHotCafe.com/My Business/Users" organizational unit:
# New York New-DynamicDistributionGroup -Name "New York Team" -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (City -like 'New York')" -RecipientContainer "AlwaysHotCafe.com/My Business/Users" # Los Angeles New-DynamicDistributionGroup -Name "Los Angeles Team" -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (City -like 'Los Angeles')" -RecipientContainer "AlwaysHotCafe.com/My Business/Users" # Austin New-DynamicDistributionGroup -Name "Austin Team" -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (City -like 'Austin')" -RecipientContainer "AlwaysHotCafe.com/My Business/Users"
Check Members
To check who is the member of the groups we use the following formula:
$dl = Get-DynamicDistributionGroup " [group name]" Get-Recipient -RecipientPreviewFilter $dl.RecipientFilter -OrganizationalUnit $dl.RecipientContainer
Comments