Solved

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

Posted on 2016-10-19
3
45 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 18

Expert Comment

by:Peter Hutchison
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks so much for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
This article will help you understand what HashTables are and how to use them in PowerShell.
In this video we show how to create a Contact 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 >> Contact ta…
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…

744 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

12 Experts available now in Live!

Get 1:1 Help Now