Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic distribution list troubles

Status
Not open for further replies.

ProliantFan

Technical User
Feb 16, 2004
26
EU
HI

I'm trying to add a filter to my all users distribution list. We use exchange 2007 sp1

We have a dynamic distribution group made in the exchange management console thats is filterd for all recipient type on the OU users. I would like to exclude 1 group of users from the all users list and i've been looking around and eventualy came up with this.

Set-DynamicDistributionGroup all -RecipientFilter {MemberOfGroup -not 'CN=Name of group,OU=Distribution Groups,OU=Groups,DC=domain,DC=local'}

But for some reason this will not work i get the following error:

Set-DynamicDistributionGroup : Cannot bind parameter 'RecipientFilter' to the t
arget. Exception setting "RecipientFilter": "Invalid filter syntax. For a descr
iption of the filter parameter syntax see the command help.
"MemberOfGroup -not 'CN=name of group,OU=Distribution Groups,OU=Groups,DC=domain,DC=local'" at position 15."
At line:1 char:50
+ Set-DynamicDistributionGroup all -RecipientFilter <<<< {MemberOfGroup -not 'CN=name of group,OU=Distribution Groups,OU=Groups,DC=domain,DC=local'}


Does anyone have a suggestion?
 
I don't think memberofgroup can be enumerated that way. I tried several methods, and none worked. I was able to filter on any of a number of other parameters, but not group membership.

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
I guess it helps if I look at the SP1 doc and not the RTM. :)

Anyways, This seems to work for me.

Get-DynamicDistributionGroup | Set-DynamicDistributionGroup -RecipientFilter {(MemberOfGroup -ne 'CN=name of group,OU=Distribution Groups,OU=Groups,DC=domain,DC=local')}

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Thnx for the help.

This seems to work but when i use powershell to view the members i see it also adds other distrubution groups that are situated in another ou on a higher level?

So i thaught why not just filter it to only do the usermailboxes so i tried this:

Set-DynamicDistributionGroup -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (MemberOfGroup -ne 'CN=name of group,OU=Distribution Groups,OU=Groups,DC=domain,DC=local'))}

I would think this should work but again an error. I'm guessing something with the ( )

Any suggestions?
 
Finaly i got the command right:

Set-DynamicDistributionGroup {nameofddl) -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (MemberOfGroup -ne 'CN=GROUP,OU=Security Groups,OU=GROUPS,DC=DOMAIN,DC=LOCAL')
 
There's a typo there (you have an opening bracket, but closing parenthesis)

Code:
[url=http://technet.microsoft.com/en-us/library/bb123796(EXCHG.80).aspx]Set-DynamicDistributionGroup[/url] "NameOfDDL" -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (MemberOfGroup -ne 'CN=GROUP,OU=Security Groups,OU=GROUPS,DC=DOMAIN,DC=LOCAL')"

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top