@Safs-3080
Try to apply another email address policy on all mailboxes to change the primary smtp address fist(Because, we cannot remove a primary smtp address directly), then we can use script below to delete them:
$Mailboxes = Get-Mailbox | where {$_.EmailAddresses -like "*domain.com*"}
foreach($Mailbox in $Mailboxes){
$temp = $Mailbox.Name
$temp2 = ((Get-Mailbox $temp).EmailAddresses -like "*@domain.com") -replace "\w*\:"
Set-Mailbox $temp -EmailAddresses @{remove=$temp2}
}
Change those two places before running:
- Don't remove "*" from this script
- The fist place don't have "@"
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.