How To Create Dynamic Distribution Group
- Home
- Cloud
- Microsoft Office 365
Hi,
the steps I'm taking to create the global all employees dynamic list as following:
- I login to the admin portal … go to admin centers … exchange
- Recipient … groups … create .. dynamic distribution list … I fill out the information and I click users with exchange mailboxes.
However, when I check it out .. it includes all users regardless if they are enabled or disabled.
Microsoft Engineer didn't help much as they offer a workaround that is not convenient and taking longer per user.
So back to my request, I'm looking to create 2 global dynamic distribution lists as following:
1- All Employees list .. with condition .. Active mailbox user (mailbox with a license) or sign-in allowed
2- Department list … with condition … Active Mailbox user (mailbox with a license) or Sign-in allowed, (Job title, Department, Office) based on the contact information for the user's mailbox.
3- I would like to check the membership in these groups to verify.
From my understanding, the task will accomplish through PowerShell. If you guys can provide me with the commands I truly appreciate it.
Thanks in advanced
Edited Sep 26, 2019 at 18:45 UTC
I reviewed the code I sent you and realized I missed a NOT. Try this:
New-DynamicDistributionGroup "AllEmployees" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not (UserAccountControl -eq "AccountDisabled, NormalAccount"))} I was able to get it to successfully work today to filter on a Recruitment distribution list based off the Department attribute being set to Recruitment and to exclude disabled accounts:
Set-DynamicDistributionGroup "Recruitment" -RecipientFilter {((Department -eq 'Recruitment') -and (RecipientType -eq 'UserMailbox') -and -not(UserAccountControl -eq "AccountDisabled, NormalAccount"))} 19 Replies
Here's three examples of the Powershell commands to check the members of a Dynamic Distribution List. Replace HR, Finance, IT with the names of your DDLs.
$FTE = Get-DynamicDistributionGroup "HR" Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter $FTE = Get-DynamicDistributionGroup "Finance" Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter $FTE = Get-DynamicDistributionGroup "IT" Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter
Cool, Thank you Mike.
What about the First & Second request?
1- All Employees list .. with condition .. Active mailbox user (mailbox with a license) or sign-in allowed
Because of Room Mailboxes, Shared Mailboxes, Generic Mailboxes (ex. info@domain.com) I use a Custom Attribute that I assign to the users for the All Employees DDL.
2- Department list … with condition … Active Mailbox user (mailbox with a license) or Sign-in allowed, (Job title, Department, Office) based on the contact information for the user's mailbox.
For Departments, I just use the Department field in AD.
That is what MS offered. however, if you have a high employees turnover … you will feel the pain every time you are adding/disabling.
any idea about powershell command will make it perfect?
I'm trying to understand why that solution isn't valid for you. When you setup an employee you just have to add their department and when you delete them, they are obviously gone from the DDL.
We don't delete them … as they might get hired back.
For Department .. we need to have office included as we have the same department in another 28 locations.
Do you remove their mailbox when they leave? If so you, rather than All recipient types you should be able to select Users with Exchange mailboxes.
We don't remove their mailboxes. for future use and reference.
Are you online only or using AD Connect to sync your users?
Online Only.
I appreciate your help. however, the only way to go is PowerShell. if I can get the correct parameter it will fix the issue.
New-DynamicDistributionGroup "AllEmployees" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not(UserAccountControl -eq'AccountDisabled') )}
Didn't work. blocked accounts still showing up.
Try
New-DynamicDistributionGroup "AllEmployees" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (UserAccountControl -eq "AccountDisabled, NormalAccount")}
I hate to tell you that it didn't work … same issue showing all disabled mailboxes.
I reviewed the code I sent you and realized I missed a NOT. Try this:
New-DynamicDistributionGroup "AllEmployees" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not (UserAccountControl -eq "AccountDisabled, NormalAccount"))} I was able to get it to successfully work today to filter on a Recruitment distribution list based off the Department attribute being set to Recruitment and to exclude disabled accounts:
Set-DynamicDistributionGroup "Recruitment" -RecipientFilter {((Department -eq 'Recruitment') -and (RecipientType -eq 'UserMailbox') -and -not(UserAccountControl -eq "AccountDisabled, NormalAccount"))}
Mike,
First one is missing close parenthesis before the closing brace … after adding the close parenthesis symbol ")" it worked :D
Now task two :P be ready … I need the job title … department and office to be included in the filter ….
correct me if I'm mistaken with the following command:
Set-DynamicDistributionGroup "ILSales" -RecipientFilter {((Department -eq 'Sales') -and (RecipientType -eq 'UserMailbox') -and (Title -eq 'Sales') -and (Office -eq 'IL') -and not(UserAccountControl -eq "AccountDisabled, NormalAccount"))}
Does it looks good?
I updated the code in my previous post. Just looks like you missed the - before not in your code.
Set-DynamicDistributionGroup "ILSales" -RecipientFilter {((Department -eq 'Sales') -and (RecipientType -eq 'UserMailbox') -and (Title -eq 'Sales') -and (Office -eq 'IL') -and -not (UserAccountControl -eq "AccountDisabled, NormalAccount"))}
Mike,
You made my day!
instead of Set- I used New- and it worked as it suppose to be …
New-DynamicDistributionGroup "ILSales" -RecipientFilter {((Department -eq 'Sales') -and (RecipientType -eq 'UserMailbox') -and (Title -eq 'Sales') -and (Office -eq 'IL') -and -not (UserAccountControl -eq "AccountDisabled, NormalAccount"))}
that is a huge thing for anyone that is going through the hassle of Dynamic Distribution Group List specially when you have thousands of mailboxes either active or not.
Thank you very much for the help :)
This topic has been locked by an administrator and is no longer open for commenting.
To continue this discussion, please ask a new question.
How To Create Dynamic Distribution Group
Source: https://community.spiceworks.com/topic/2234296-creating-dynamic-distribution-list-exchange-online
Posted by: cainrothe1964.blogspot.com

0 Response to "How To Create Dynamic Distribution Group"
Post a Comment