We have a number of default e-mail domains for various staff. We are applying a retention policy only to the default domain, not to the others. So I need to find a way to find all mailboxes whose reply-to domain is not MyDomain.com. I know the prefix will be SMTP:, but the domain is sometimes listed as mydomain or MyDomain, so it seems trying to use case sensitivity on the string won't work.
I was trying to use something like:
get-mailbox -resultsize unlimited | where-object {$_.EmailAddresses -notlike 'SMTP:*@mydomain.com'}
Suggestions are appreciated.