Answered by:
CustomAttributeX -ne $null not working in -RecipientFilter

Question
-
I am trying to create a dynamic distribution Group that will only return users who have CustomAttribute9 with numeric string and exclude any users who do not have that attribute populated. Here is my filter
New-DynamicDistributionGroup -Name GCI-AaronPTest -RecipientFilter {(RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser') -And (CustomAttribute9 -like '0*') -and (Customattribute9 -ne $null)}
This is still returning users who have blank field for CustomAttribute9. Any help would be appreciated.
Wednesday, December 18, 2013 1:37 PM
Answers
-
Hi,
I recommend you try the following command and check the result:
New-DynamicDistributionGroup -Name GCI –Alias GCI -RecipientFilter {(RecipientType -eq 'UserMailbox' -or RecipientType -eq 'MailUser') –And (CustomAttribute9 -like '0*' -or Customattribute9 -ne $null)}
Hope this helps!
Thanks.
Niko Cheng
TechNet Community Support- Marked as answer by Simon_WuMicrosoft contingent staff, Moderator Tuesday, January 7, 2014 5:28 PM
Thursday, December 19, 2013 3:24 AMModerator -
I am trying to create a dynamic distribution Group that will only return users who have CustomAttribute9 with numeric string and exclude any users who do not have that attribute populated. Here is my filter
New-DynamicDistributionGroup -Name GCI-AaronPTest -RecipientFilter {(RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser') -And (CustomAttribute9 -like '0*') -and (Customattribute9 -ne $null)}
This is still returning users who have blank field for CustomAttribute9. Any help would be appreciated.
Hi
Try this one :
New-DynamicDistributionGroup -Name GCI-AaronPTest -RecipientFilter {((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser')) -And ((CustomAttribute9 -like '0*') -and (Customattribute9 -ne $null))}
MCITP - Exchange 2010 | MCITP - Windows Server 2008 R2
- Marked as answer by Simon_WuMicrosoft contingent staff, Moderator Tuesday, January 7, 2014 5:28 PM
Thursday, December 19, 2013 3:47 AM
All replies
-
Hi,
I recommend you try the following command and check the result:
New-DynamicDistributionGroup -Name GCI –Alias GCI -RecipientFilter {(RecipientType -eq 'UserMailbox' -or RecipientType -eq 'MailUser') –And (CustomAttribute9 -like '0*' -or Customattribute9 -ne $null)}
Hope this helps!
Thanks.
Niko Cheng
TechNet Community Support- Marked as answer by Simon_WuMicrosoft contingent staff, Moderator Tuesday, January 7, 2014 5:28 PM
Thursday, December 19, 2013 3:24 AMModerator -
I am trying to create a dynamic distribution Group that will only return users who have CustomAttribute9 with numeric string and exclude any users who do not have that attribute populated. Here is my filter
New-DynamicDistributionGroup -Name GCI-AaronPTest -RecipientFilter {(RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser') -And (CustomAttribute9 -like '0*') -and (Customattribute9 -ne $null)}
This is still returning users who have blank field for CustomAttribute9. Any help would be appreciated.
Hi
Try this one :
New-DynamicDistributionGroup -Name GCI-AaronPTest -RecipientFilter {((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser')) -And ((CustomAttribute9 -like '0*') -and (Customattribute9 -ne $null))}
MCITP - Exchange 2010 | MCITP - Windows Server 2008 R2
- Marked as answer by Simon_WuMicrosoft contingent staff, Moderator Tuesday, January 7, 2014 5:28 PM
Thursday, December 19, 2013 3:47 AM -
Hi,
I recommend you try the following command and check the result:
New-DynamicDistributionGroup -Name GCI –Alias GCI -RecipientFilter {(RecipientType -eq 'UserMailbox' -or RecipientType -eq 'MailUser') –And (CustomAttribute9 -like '0*' -or Customattribute9 -ne $null)}
Hope this helps!
Thanks.
Niko Cheng
TechNet Community Support(RecipientType -eq 'UserMailbox' -or RecipientType -eq 'MailUser') –And (CustomAttribute9 -like '0*' -or Customattribute9 -ne $null)
this will include all mailbox or mail user which have customattribute9 other than like '0*' too .
so , replace just -or with -and in
(CustomAttribute9 -like '0*' -or Customattribute9 -ne $null)
to achieve the result.
MCITP - Exchange 2010 | MCITP - Windows Server 2008 R2
Thursday, December 19, 2013 3:58 AM -
-
Hi,
you have to escape the NULL-value.
New-DynamicDistributionGroup -Name GCI-AaronPTest -RecipientFilter {(RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser') -And (CustomAttribute9 -like '0*') -and (Customattribute9 -ne `$null)}
Don't forget to mark this post as answer.
Greetings
- Proposed as answer by Michael Bast Tuesday, July 25, 2017 9:09 AM
Tuesday, July 25, 2017 9:09 AM