Hi, I am trying to create a script that will create an Address List based on all Users in an Organizational Unit. Each user is external to out organization - meaning they have a logon like user.name@ourdomain.com but have an email address but it is not at ourdomain.com.
I did find a way to create an Address List and have tried multiple different RecipientFilters. I have tried things like
Set-AddressList -Identity "\External Users" -RecipientFilter {$_.EmailAddress -notlike "*mydomain.com*"}< Not sure if this syntax is correct but you get the idea.
The latest attempt consisted of creating a distribution group and adding a single user to it. Then setting the address list with MemberOfGroup.
$group = $(get-distributionGroup ExternalDistribution).DistinguishedName
Set-AddressList -Identity "\External Users" -RecipientFilter "MemberOfGroup -like '$group'"
Any help is greatly appreciated,
Michael