Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I was able to remove one user using this command:

Set-DynamicDistributionGroup -Identity "All Staff" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not(Name -like 'Employment'))} 

But I have more than one mailbox that I want to remove. Is it possible to add another mailbox into the above command?

share|improve this question

2 Answers 2

Unless there is some common property you can use to filter against all the recipients you have to exclude, you will need to exclude them one by one using multiple exclusion filters.

share|improve this answer
    
Matt, Thank you. –  Harbert Tom Jan 8 '13 at 5:32
1  
This is the command used in case someone else needs help: Set-DynamicDistributionGroup -Identity DDGName -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not(Name -like 'Display Name 1') -and -not(Name -like 'Display Name 2') -and -not(Name -like 'Display Name 3') -and -not(Name -like 'Display name etc.'))} –  Harbert Tom Jan 8 '13 at 5:33

A manageable solution would probably be one that meant you didn't have to keep coming back to change the recipient filter every time a new candidate for exclusion was created.

I had to implement a recipient filter the other day for a management scope. The filter was based on a security group. So from the security group angle, you could create a security group and manage your exclusions using that. For example, your filter would look like:

{((RecipientType -eq 'UserMailbox') -and -not(MemberOfGroup -eq 'AllStaff_Exclusion_Group'))}

Equally, you could just use the SG to include staff members, removing the need for a complicated filter.If it helps, heres a list of all filterable properties. There are many, so it's possible you could find one that your excluded recipients have in common.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.