Cannot bind parameter ‘RecipientFilter’ to the target. Exception setting “RecipientFilter”



Full error:
Invoke-Command : Cannot bind parameter ‘RecipientFilter’ to the target. Exception setting “RecipientFilter”: “Invalid filter syntax. For a description of the filter parameter syntax see the command help.
“((UserPrincipalName -like ‘*@domain2.com’) -and (Alias -ne ))” at position 67.”
At *:39341 char:29
+ $scriptCmd = { & <<<< $script:InvokeCommand `
+ CategoryInfo : WriteError: (:) [Set-EmailAddressPolicy], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed, Microsoft.Exchange.Management.SystemConfigurationTasks.SetEmailAddressPolicy
This error is caused by an invalid syntax when setting the RecipientFilter. Normally when using powershell commands you will enclose everything in quotes. This is not the case with the RecipientFilter. You must put the value in-between curly braces { }.
Wrong:
- -RecipientFilter "((UserPrincipalName -like '*@domain2.com') -and (Alias -ne $null))"
CORRECT:
- -RecipientFilter {((UserPrincipalName -like '*@domain2.com') -and (Alias -ne $null))}
- Add new comment
- 1 comment
nice article.....
nice article.....
Post new comment