Solved

Assistance Required with Powershell command to modify Dynamic Distribution Group - Exchange 2010

Posted on 2016-10-19
3
82 Views
Last Modified: 2016-10-20
Hi There,

I am needing to add to this existing dynamic distribution group an additional filter. The filter is to exclude from this group exchange mailboxes that have been selected to be hidden from address lists. I believe filter to add is this: -and -not(HiddenfromAddresslistsEnabled -eq $true)

However I am running into an issue when adding in this filter as nothing is being accepted in powershell when trying to modify the filter. Can someone please assist with letting me know the required command to update the filter to include the new filter "-and -not(HiddenfromAddresslistsEnabled -eq $true)" ?

The current filter is shown below and I have also attached a screen capture.

((((((RecipientType -eq 'UserMailbox') -and (-not(Name -like 'Belton IT')))) -and (-not(Name -like 'support')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))
done.PNG
0
Comment
Question by:beltonnz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Expert Comment

by:Peter Hutchison
ID: 41852093
Try this to get the old filter and append the new filter text and set the group with the new filter.

$grp = Get-DynamicDistributionGroup "group name"
$filter = $grp.RecipientFilter
$newfilter = " -and -not(HiddenfromAddresslistsEnabled -eq $true)"
$newstr = "$filter $newfilter"
Set-DynamicDistributionGroup "group name" -RecipientFilter $newstr
0
 
LVL 15

Accepted Solution

by:
Todd Nelson earned 500 total points
ID: 41852095
Run this command first to get the recipient filter value for your dynamic distribution group (DDG)...

Get-DynamicDistributionGroup -Identity "DDG_NAME" | fl Name,RecipientFilter

Open in new window


The result should return something similar to this currently set for the filter...

((((CustomAttribute1 -eq 'TestDDG') -and (Alias -ne $null))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))

Open in new window


Before the last parentheses, I added " -and (-not(HiddenFromAddressListsEnabled -eq 'True'))" to format the value that will make up the updated filter...

{((((CustomAttribute1 -eq 'TestDDG') -and (Alias -ne $null))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -and (-not(HiddenFromAddressListsEnabled -eq 'True')))}

Open in new window


NOTE: The filter must be encapsulated with the squiggly brackets or an error will occur.  An error will occur even when quotes are used too.

Finally, to update the filter, I ran the command like this.

Set-DynamicDistributionGroup -Identity "DDG_NAME" -RecipientFilter {((((CustomAttribute1 -eq 'TestDDG') -and (Alias -ne $null))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -and (-not(HiddenFromAddressListsEnabled -eq 'True')))}

Open in new window


Upon completion, verification of the DDG resulted in mailboxes explicitly hidden from the GAL that do not show when previewing from the DDG Filter tab.

P.S. What you are requesting to do only satisfies the admin's preview from the DDG in the Exchange mgmt. console, as the mailboxes that are hidden from the GAL are not visible for users using Outlook or OWA.
2
 
LVL 1

Author Closing Comment

by:beltonnz
ID: 41853031
Thanks so much for your help.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
In-place Upgrading Dirsync to Azure AD Connect
This video discusses moving either the default database or any database to a new volume.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question