Jaa


Adding Customized Email Addresses On Bulk Users

I had a chance to work on a support case where the requirement was to added Customized email address on bulk users, Make them as primary smtp address and keep the original smtp address as secondary 

Eg: FirstName.LastName.Custom@Domain.Com

Using Email Address Policies we cannot add "Custom" as a word however we can do it manually on a single users by going into Exchange management Console , Select the user, go to properties, E-Mail Addresses tab and add it.

How can we do it in bulk ?

Step 1

Create a CSV file and name it as EmailAddress.Csv with two columns:

LoginName, SecondaryAddress

I.e:

LoginName, SecondaryAddress

TestUser, TestUser.Custom@Domain.Com

Step 2

Run the below command to start importing the Csv file

Import-Csv EmailAddress.Csv | Foreach-Object{

$user = Get-Mailbox -Identity $_.LoginName

$user.EmailAddresses+=$_.SecondaryAddress

Set-Mailbox $user -EmailAddresses $user.EmailAddresses

Set-Mailbox $user –EmailAddressPolicyEnabled:$False

Set-Mailbox $user –PrimarySMTPAddress $_.SecondaryAddress 

}

So what does the command do 

 

  1. Add's the email address TestUser.Custom@Domain.Com as secondary address.
  2. Disable "Automatically update e-mail addresses based on recipient policy" for the users listed in Csv file
  3. Set's the primary smtp address to secondary.

Note: Please test the commands in your Lab and the perform the task in production.

Special Thanks to Ravi Nagaraja in helping me with the commands.

Comments

  • Anonymous
    February 26, 2015
    thanks