Dynamic distribution group in Exchange 2010 with 6 sub domains

Hi Guys
I really need some help here ?

I have Exchange 2010 Setup running with Windows server 2008

There is a root domain with 6 sub domains
Sub domains are located in different countries

My Boss wants me to create a dynamic distribution group where all users from entire Exchange origination ,with mail enabled mailbox ,have to be member of this dynamic distribution. But consulted user has to be excluded.

He want me to do it easiest way. Like Power Shell

The big question, how can I do that?

Is it possible to make a Power shell cmdlet  

Remember users /mailboxes are locate in the 6 sub domains , some users /mailboxes are in the root domain
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here is how you should proceed:

Add a unique custom attribute to rest of the users (Excluding Consultants) and include that attribute for creating the DD Group.

You can add the attribute with this Command:
Get-Mailbox | Set-Mailbox -CustomAttribute1 "any attribute you like"

Powershell command to Create Dynamic Distribution group:

New-DynamicDistributionGroup -Name <group name> -RecipientFilter {<custom filter attribute conditions>}
johnfreakAuthor Commented:


thanks for the answer :)

I have now try it on my test exchange 2007
Get-Mailbox | Set-Mailbox -CustomAttribute1 "test attribute"

where do I find the attribute "test attribute"on user account in AD users and Computers ?

and when I run the powerhell command Get-Mailbox | Set-Mailbox -CustomAttribute1 "test attribute"
 how can I Excluding Consultants? with the powerhell command I hit all users with mailbox  right ?

New-DynamicDistributionGroup -Name <group name> -RecipientFilter {<custom filter attribute conditions>what do I type here the attribute name ? } ?

How can all theese users with CustomAttribute1 "test attribute" be member of my New-DynamicDistributionGroup ?

Please help ?

You need to add this attribute to your user. It is called a Custom Attribute. Or if your users have a unique attribute which your consultants don't have, then you can use that attribute as well. For Example your users might have an office location  associated with their account while as Consultants might not have this information and there is how you can filter them.

Here is an Example:
new-DynamicDistributionGroup testdist2 -RecipientContainer "OU=Employees,DC=Playlsi,DC=com" -OrganizationalUnit "OU=Mail Distribution Groups,DC=Playlsi,DC=com" -RecipientFilter {((RecipientType -eq 'UserMailbox')-and -not (Name -like '*room*'))}

More Information:




Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

johnfreakAuthor Commented:
Thanks a lot for the answer

its it possible you can make me a powershell comand ,

where I get all mailboxes , and make them member of the new-DynamicDistributionGroup but all
users who is member of the Consultants group should not be member of this new-DynamicDistributionGroup

Is that possible to exclude a member of group ?

Hope you understand what I mean ? :)

My boss dont like the attribute  idea Sorry :( long story

johnfreakAuthor Commented:

As I can see now the consult have no member of group which is in common

Only thing there is in common in all sub domains is the are in a OU alle same named Consultants
any idea whats the best solution could be .

Mayby some how with powershell field out the description field with name consult and then exclude the

description field , ( any user who has consult in description field have to be excluded)

What do you think
johnfreakAuthor Commented:
I did assosiate with the Company name .

It works now

( any user who has consult in description field have to be excluded)

Looks good to me. But Custom Attributes would have been much better. Let me know if you would want me to write a script for you for filtering based on Description.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.