Scenario: You want to query all Exchange recipients that do not have a email alias with the @XYZ.com domain.
Script: Use this command to export the recipients to a .csv.
get-recipient * -filter {emailaddresses -notlike ‘*@xyz.com’} -ResultSize unlimited | Export-csv C:tempxyz.csv