Hi -
I am trying to pull a list of students that are in our AD, but not yet mail-enabled. There are certain criteria I need to filter to obtain the correct students.
I'm looking for something like this:
Get-Recipient -OrganizationalUnit "Students" -Filter {(CustomAttribute2 -eq 'student') -and (CustomAttribute15 -eq 'Yes') -and (EmailAddresses -ne '*@*')} -ResultSize Unlimited
The filtering on CustomAttribute2 and CustomAttribute15 is working fine, but I can't seem to find a way to filter to find those students without an email address.
I've also tried:
Get-Recipient -OrganizationalUnit "Students" -Filter {(CustomAttribute2 -eq 'student') -and (CustomAttribute15 -eq 'Yes')} -ResultSize Unlimited | where {$_.EmailAddresses -eq $null}
And I've also tried a bunch of variants in between - I've tried filtering on these properties too:
RecipientType -ne 'mailuser'
ExternalEmailAddress -eq $null
And I've tried the piped "where" on these too, but no luck.
I know I must be missing the boat somewhere. Is there a way to filter and find users by their lack of email address?
Any assistance is much appreciated!
Thank you!