Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-10-19
3
Medium Priority
?
153 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:Benlton IT
[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 20

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 16

Accepted Solution

by:
Todd Nelson earned 2000 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:Benlton IT
ID: 41853031
Thanks so much for your help.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

New style of hardware planning for Microsoft Exchange server.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
In this video we show how to create an Address List 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 Organization >> Ad…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

604 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