Solved:
When storing these external users, exchange will replace the "@" symbol in the User Principle Name with an "_", leaving the emails to look like this: exampleemail_outlook.com#EXT#@company.com. This issue was resolved by changing Select-Object -ExpandProperty UserPrincipalName to Select-Object -ExpandProperty Mail.