#Disable Address Policy on every contact in the OU (buonvicini.local/Exchange/Recipients External).
Get-MailContact -OrganizationalUnit "myorg.org/Exchange/Recipients External" | Set-MailContact -EmailAddressPolicyEnabled:$false
# Removes the specified email domain from all contacts in the OU (myorg.org/Exchange/Recipients External).
Get-MailContact -OrganizationalUnit "myorg.org/Exchange/Recipients External" -ResultSize unlimited -IgnoreDefaultScope | foreach {$contact = $_;
$email = $contact.emailaddresses;
$email | foreach {if ($_.smtpaddress -like "*contoso.com") {$address = $_.smtpaddress;}
write-host "Removing address" $address "from Contact" $contact.name;
Set-Mailcontact -Identity $contact.identity -EmailAddresses @{Remove=$address};
$contact | set-mailcontact -emailaddresspolicyenabled $false}
}