Exclude specific OU or User from Dynamic Distribution Groups
Hey All, Most likely a simple question but I am in a situation where I need to exclude specific Users or OUs from our "All Staff" Dynamic Distribution Lists. That being said, is it possible and if so then how can I do it in Exchange 2010? This is a new Exchange Org, not migrated from any other version and Exchange is running on Server 2008 R2.
April 4th, 2011 1:57pm

Something like this. new-dynamicdistributiongroup -name 'MydynamicDL' -organizationalUnit 'domain.net/groups/' -recipientfilter "(RecipientContainer -ne domain.net/excludeOU)" James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2011 3:15pm

Tried that and it didn't work, had to modify it slightly to get the command to run in Shell. This is the command I used: New-DynamicDistributionGroup -name "Test All Staff" -OrganizationalUnit "sd87.bc.ca" -RecipientFilter {RecipientContainer -ne "sd87.bc.ca/Out of District Contacts"} The command completed however it does not exclude the Out of District Staff OU as expected.
April 4th, 2011 4:36pm

I forgot you can't filter on OUs this goes back to pre Exchange 2007 because it's not a user attribute. The way users get around this is you have to get creative and filter on some other common property for users in this OU. If there is no common property for these users that are isolated to just within this OU then you need to populate a custom one then filter on that custom property. Filterable Properties for the -Filter Parameter in Exchange 2007 SP1 and SP2 http://technet.microsoft.com/en-us/library/bb738155(EXCHG.80).aspxJames Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2011 7:51pm

Is it possible to exclude specific users rather than OUs? It's still a lot less work for me to exclude a few users than it is to manually create/manage the distribution list for our entire organization. I see a lot of custom attribute filters but being new to Exchange I honestly have no real idea on how to use them properly and have not been able to do so successfully.
April 4th, 2011 7:56pm

Yes, you have to append a custom attribute to users in this OU. For example Get-Mailbox -OrganizationalUnit "OU=Test,DC=Contoso,DC=com" | Set-Mailbox -CustomAttribute1 "test" Then you create the DDL filter to exclude custom attribute -notlike (-ne) test http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/edb0eb8a-83d4-458b-b2e0-abfb2ff34339/ http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/11bdf8d2-9ea3-4c92-b130-d6be8c537b5d James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2011 8:19pm

So I attempted to run that command and I can't get it to work for the life of me, I posted the shell command that verifies that the OU exists but every time I attempt to use set-mailbox it tells me that the OU doesn't exist. I'm stumped, any thoughts? I've tried the below commands with both old and new OUs and always seem to get the same result. [PS] C:\Windows\system32>Get-OrganizationalUnit "OU=Test,DC=sd87,DC=bc,DC=ca" RunspaceId : 33e2b808-3623-4869-aabf-8d26973deb45 Type : OrganizationalUnit CanonicalName : sd87.bc.ca/Test IsWellKnownContainer : False AdminDisplayName : ExchangeVersion : 0.0 (6.5.6500.0) Name : Test DistinguishedName : OU=Test,DC=sd87,DC=bc,DC=ca Identity : sd87.bc.ca/Test Guid : 47225526-ab7a-4352-bb25-55a1ca65ee48 ObjectCategory : sd87.bc.ca/Configuration/Schema/Organizational-Unit ObjectClass : {top, organizationalUnit} WhenChanged : 05/04/2011 8:23:59 AM WhenCreated : 05/04/2011 8:23:44 AM WhenChangedUTC : 05/04/2011 3:23:59 PM WhenCreatedUTC : 05/04/2011 3:23:44 PM OrganizationId : OriginatingServer : denetia1.sd87.bc.ca IsValid : True [PS] C:\Windows\system32>Get-OrganizationalUnit "OU=Test,DC=sd87,DC=bc,DC=ca" | Set-Mailbox -CustomAttribute1 "test" The operation couldn't be performed because object 'sd87.bc.ca/Test' couldn't be found on 'denetia1.sd87.bc.ca'. + CategoryInfo : NotSpecified: (0:Int32) [Set-Mailbox], ManagementObjectNotFoundException + FullyQualifiedErrorId : C7BE9C17,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
April 5th, 2011 11:36am

[PS] C:\Windows\system32>Get-OrganizationalUnit "OU=Test,DC=sd87,DC=bc,DC=ca" | Set-Mailbox -CustomAttribute1 "test" The operation couldn't be performed because object 'sd87.bc.ca/Test' couldn't be found on 'denetia1.sd87.bc.ca'. + CategoryInfo : NotSpecified: (0:Int32) [Set-Mailbox], ManagementObjectNotFoundException + FullyQualifiedErrorId : C7BE9C17,Microsoft.Exchange.Management.RecipientTasks.SetMailbox Hi tbradley, Please run the cmdlet Get-Mailbox -OrganizationalUnit "sd87.bc.ca/Test" | Set-Mailbox -CustomAttribute1 "test" as James said.Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 6th, 2011 10:21pm

Thank you, I don't know how I managed to miss that. Working on too many things at once I guess, need to slow down a little.
April 7th, 2011 11:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics