Removing SMTP Address in Bulk

Microsoft Exchange

Let’s say you have 100 mailboxes and you want to remove the smtp address in bulk, below are the steps you can follow in order to do so.

Open Exchange Shell as administrator.

Run the below two (2) commands one after the other.

$qwe= get-content c:\New Folder\user.csv | Get-Mailbox

$qwe | set-mailbox -emailaddresspolicyenabled:$True

Then run the below script and press enter two times.
________________________________________________________________

foreach($i in Get-Content c:\New Folder\user.csv | Get-Mailbox -ResultSize Unlimited) {
$i.EmailAddresses |
?{$_.AddressString -like ‘*@domain.com’} | %{
Set-Mailbox $i -EmailAddresses @{remove=$_}
}
}
___________________________________________________________________

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.