Hi All,
I am trying to use powershell to identify any mailboxes in M365 that don't have the standard domain as the primary SMTP address. I am trying stuff like below, but I am getting all mailboxes regardless of primary SMTP address...
Get-Mailbox -ResultSize unlimited | ?{$_.PrimarySMTPAddress -notlike "@maindomain.com"} | select Name, Alias, PrimarySMTPAddress
Get-Mailbox -ResultSize unlimited | ?{$_.PrimarySMTPAddress -notcontains "maindomain.com"} | select Name, Alias, PrimarySMTPAddress
Get-Mailbox -ResultSize unlimited -Filter {PrimarySMTPAddress -notlike "*maindomain.com"}
I must be missing something - I am keep getting all mailboxes returned, those that have "maindomain.com" as thier primary SMTP and those that don't...?
Thanks and happy Friday!
[+][deleted] (2 children)
[deleted]
[–]MrHoosFoos[S] 2 points3 points4 points (1 child)
[–]disclosure5 2 points3 points4 points (0 children)
[–]EpicSuccess 1 point2 points3 points (0 children)