Filter Addresslist by OU?

All -

I am currently running this powershell to create an addresslist that searches for any contacts that ends with "". The problem is I want to narrow this down so it does not search the entire domain, but rather focus on 1 OU. Is this possible with the "new-addresslist" command? I am not sure how to do this. I have attempted to use "recipientcontainer" but from what I'm reading, you can't use that when you are using "recipientfilter".

The current command I have is: (which does not narrow to the specific OU)
new-addresslist -name "Blah Contacts" -recipientfilter {(recipienttype -eq 'MailContact') -and (ExternalEmailAddress -like "*")}

Open in new window

LVL 16
ThinkPaperIT ConsultantAsked:
Who is Participating?
SubsunConnect With a Mentor Commented:
OU (organizationalUnit) is not a filterable property.. So you cannot create an address list with users from an OU..You can use a CustomAttribute, memberOf or any other filterable attribute.


PS : If you are using CustomAttribute or memberOf to create the addresslist,then you need to schedule another script to update the attribute (CustomAttribute or memberOf.) for all users in that OU.
ThinkPaperIT ConsultantAuthor Commented:
Argg I was afraid of that! =)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.