Hello,
You cannot use “not like” or “not to” in this command.
As for a workaround solution, you can first find all the emails with
1. internal address
2. both and internal address and external address
by the following command:
Search-Mailbox -Identity "xxx" -SearchQuery 'To:"@domain.com"' -TargetMailbox "xxxx" -TargetFolder "xxxx"
Then manually delete the emails that only have the internal address in the To: filed.
Thanks,
Simon