question

aleework-4130 avatar image
0 Votes"
aleework-4130 asked KaelYao-MSFT commented

Exchange Server - Internal DDG Filter Including Mailboxes from Other Company Division

Below is an example of the DDG recipient filter that is only supposed to include mailboxes from CompanyA:
((((MemberOfGroup -eq 'CN=#CompanyA - Rigs Universal,OU=CompanyADistributionGroups,OU=CompanyAUsers,DC=CompanyA,DC=internal') -or (((((((((((RecipientType -eq 'UserMailbox') -and (Company -eq 'CompanyA'))) -and (Title -eq 'CompanyA Relief Push'))) -or (Title -like 'Rig Manager'))) -or (((((((RemoteRecipientType -eq 'Migrated') -and (Company -eq 'CompanyA'))) -and (Title -eq 'CompanyA Relief Push'))) -or (Title -like 'Rig Manager'))))) -or (((((((RecipientType -eq 'MailContact') -and (Company -eq 'CompanyA'))) -and (Title -eq 'CompanyA Relief Push'))) -or (Title -like 'Rig Manager'))))))) -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')))

For some reason, internal mailboxes from CompanyB are also included in the DDG. The only similarity I found was that the "Rig Manager" title field was the same.

Any ideas as to why the CompanyB would be included? Based on the criteria combined, the mailboxes included in the DDG should only be CompanyA company and Rig Manager title. Please advise if you have any thoughts on this. Thanks.

windows-server-powershelloffice-exchange-server-administrationoffice-exchange-server-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KaelYao-MSFT avatar image
1 Vote"
KaelYao-MSFT answered KaelYao-MSFT commented

Hi @aleework-4130

According to your post, I suppose the problem may be the following syntax:

 -and (Company -eq 'CompanyA') -and (Title -eq 'CompanyA Relief Push') -or (Title -like 'Rig Manager')

This syntax would add mailboxes whose Company is CompanyA and Title equals CompanyA Relief Push, or mailboxes whose Title contains Rig Manager (this would add CompanyB's Rig Manager to this DDG)


To be simple, it is supposed to be A and (B or C), but currently it is (A and B) or C.


I suppose the right syntax here should be:

 -and (Company -eq 'CompanyA') -and (Title -eq 'CompanyA Relief Push' -or Title -like 'Rig Manager')

The whole filter should be like:

 (MemberOfGroup -eq 'CN=#CompanyA - Rigs Universal,OU=CompanyADistributionGroups,OU=CompanyAUsers,DC=CompanyA,DC=internal') -or ((RecipientType -eq 'UserMailbox') -and (Company -eq 'CompanyA') -and (Title -eq 'CompanyA Relief Push' -or Title -like 'Rig Manager')) -or ((RemoteRecipientType -eq 'Migrated') -and (Company -eq 'CompanyA') -and (Title -eq 'CompanyA Relief Push' -or Title -like 'Rig Manager')) -or ((RecipientType -eq 'MailContact') -and (Company -eq 'CompanyA') -and (Title -eq 'CompanyA Relief Push' -or Title -like 'Rig Manager')) -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'))

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @aleework-4130

Just checking in to see if above information was helpful.
Please let us know if you would like further assistance.

1 Vote 1 ·

Yes, this was helpful. Thank you for your help on this. I have readjusted the syntax of the code and it is giving the results that we were expecting now.

0 Votes 0 ·

Hi,

Glad to hear the issue has been resolved!

Please feel free to accept the reply as the answer to the question if it helped you with this issue.
To accept an answer in Q&A

It would help other community members as well.


0 Votes 0 ·