Solved

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

Posted on 2016-10-19
3
61 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
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 14

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now