Recipient Filter Syntax

Hi,

I have tried to get a recipient policy going for Exchange 2013 based on database.  Here is the command and error I get"

New-EmailAddressPolicy -Name 'Students' -EnabledPrimarySMTPAddressTemplates "SMTP:%g.%s@students.olin.edu" -Priority '1' -IncludedRecipients MailboxUsers -RecipientFilter { (Database -eq "CN=Students,CN=Databases,CN=Exchange Administrative Group(FYDIBOHF23SPDLT),CN=AdministrativeGroups,CN=OLIN,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ADroot,DC=local") }

Parameter set cannot be resolved using the specified named parameters.
    + CategoryInfo          : InvalidArgument: (:) [New-EmailAddressPolicy], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,New-EmailAddressPolicy
    + PSComputerName        : ex03.olin.edu

I have tried numerous things and looked around but have yet to determine what is wrong in the syntax above.  Any ideas?

Thanks,

Kurt


  • Edited by k2009 12 hours 35 minutes ago
August 21st, 2015 6:43pm

According to the documentation:

https://technet.microsoft.com/en-us/library/bb124517%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396

You can't combine IncludedRecipients and RecipientFilter.  Drop the IncludedRecipients since it's moot, anything with a database is a MailboxUser anyway.

Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2015 11:15pm

Ed,

I took that out and still get the same error:

[PS] C:\Users\milkyway_adm\Desktop>New-EmailAddressPolicy -Name 'Students' -EnabledPrimarySMTPAddressTemplates "SMTP:%g.%s@students.olin.edu" -Priority '1' -RecipientFilt
er { (Database -eq "CN=Students,CN=Databases,CN=Exchange Administrative Group(FYDIBOHF23SPDLT),CN=AdministrativeGroups,CN=OLIN,CN=Microsoft Exchange,CN=Services,CN=Config
uration,DC=ADroot,DC=local") }
Parameter set cannot be resolved using the specified named parameters.
    + CategoryInfo          : InvalidArgument: (:) [New-EmailAddressPolicy], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,New-EmailAddressPolicy
    + PSComputerName        : ex03.olin.edu

Thanks,

Kurt

August 24th, 2015 6:11pm

The syntax looks right.  Are you sure you have the DN correct?  You might try this:

$DN = (Get-MailboxDatabase -Identity Students).DistinguishedName
New-EmailAddressPolicy -Name 'Students' -EnabledPrimarySMTPAddressTemplates "SMTP:%g.%s@students.olin.edu" -Priority '1' -RecipientFilter {(Database -eq $DN)}

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 4:38am

Good idea.  However I just tried that and still get the same error.  Would either of these two things be affecting this?  We are running a DAG and we are in co-existence with Exchange 2007.

Thanks, Kurt

New-EmailAddressPolicy -Name 'Students' -EnabledPrimarySMTPAddressTemplates "SMTP:%g.%s@students.olin.edu" -Priority '1' -RecipientFilter {(Database -eq $DN)}
Parameter set cannot be resolved using the specified named parameters.
    + CategoryInfo          : InvalidArgument: (:) [New-EmailAddressPolicy], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,New-EmailAddressPolicy
    + PSComputerName        : ex03.olin.edu

August 25th, 2015 1:17pm

Also, if this is supposed to work and the syntax is correct, we need to figure out if this is an issue with a Powershell bug or an actual issue in our environment that is causing this.  I don't suppose someone could run this in a test to verify that it works as intended?  Maybe using the -whatif flag so it doesn't harm anything in your environment.

  • Edited by k2009 Tuesday, August 25, 2015 3:16 PM
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 2:26pm

The DAG wouldn't make any difference, nor would I think that coexistence would.  Is the domain you're applying an accepted domain?

August 25th, 2015 3:49pm

Looks like there was a syntax error.  -EnabledPrimarySMTPAddressTemplates should not have has the "s" at the end.  That fixed it.

However, although I do see the policy listed in the GUI now, when I go to a mailbox I previously migrated into that database (that got an additional address due to the default recipient policy in Exchange 2013), the recipient policy is not applied.  I have also unchecked the option to apply the email address policy, and then gone back in and reactivated it, and it still inherits the old address.  Is there anything I need to further do to make the policy active? (I did click on Activate in the GUI).

Thanks,

Kurt

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 6:48pm

You mean e-mail address policy, not recipient policy.  You're showing your age!  Have you run Update-EmailAddressPolicy?
August 25th, 2015 7:02pm

Yes, I have been doing this for awhile :).

If clicking apply with an email address policy highlighted in the GUI is the same thing as Update-EmailAddressPolicy then yes.  I also just tried it from the shell.

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 8:26pm

And there's no e-mail address policy with a higher priority that matches?
August 25th, 2015 9:54pm

No.  It is the highest policy that deals with those recipients or database.  When I click the link to preview the recipients that the policy will apply to in the GUI it comes up empty.  This is the filter it lists in the GUI:

Database -eq 'CN=Students,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=AdministrativeGroups,CN=OLIN,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ADroot,DC=local'

To make matters worse it also won't let me do a workaround in the GUI for an email address policy by OU, coming up with an error that states that it cannot be created because there are legacy Exchange servers in the organization.  Because I cannot get a recipient filter going for this large group of people it has halted our migration, as any of them I migrate get a different primary address that is incorrect.

Has anyone successfully created an email address policy in Exchange 2013 that filters by database?  If so I would love to see the filter.  I am using the database filter parameter from here:  https://technet.microsoft.com/en-us/library/bb738157%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396 which says it will accept a DN or even the Identity.

Free Windows Admin Tool Kit Click here and download it now
August 26th, 2015 9:09am

I have also tried adding -and RecipientType -eq 'UserMailbox' to the filter but no change.
August 26th, 2015 10:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics