I have a script that enumerates users with an SMTP alias of a different domain name, but I want it to display only that domain name’s SMTP alias

I work for Contoso in our New York office. We run Exchange 2010. Contoso has two other domains that have MX records for mail, Adatum.com and Fabrikam.com. Not all Contoso users have Adatum or Fabrikam SMTP addresses. Some users who have a Contoso or Adatum address have it as their primary SMTP address, some don’t.

I need to produce a list of all Adatum and Fabrikam email addresses in New York. The below script will give me a list of people, but it lists all their addresses:

get-recipient -resultsize unlimited | where {$_.emailaddresses -like "*adatum.com" -or $_.emailaddresses -like "*fabrikam.com" -and $_.servername -like "NYEXCHANGE1*" | select name,Alias,emailaddress 

Is there a way to take the emailaddress part and filter it to only show the matching @contoso.com or @fabrikam.com address?

submitted by /u/MohnJaddenPowers
[link] [comments]

Leave a Reply