Adding additional SMTP address for new domain.
I've added a new domain to my exchange environment and modified the default policy to add an SMTP address for the new domain. For example, the PrimarySmtpAddress is user1@domain.com and the policy adds user1@newdomain.com as an additional SMTP address which allows the user to receive email sent to either address. However we have several users that have multiple addresses. For example, user1 may have user1@domain.com, u@domain.com, yourmom@domain.com, etc... For each of these additional addresses, I need to also add a corresponding address for newdomain.com. Any address @domain.com should also have an address @newdomain.com (user1@newdomain.com, u@newdomain.com, yourmom@newdomain.com) How can I automate this task using EMC or EMS?
August 2nd, 2011 3:40pm

If those extra addresses (u@domain.com) have been added manually, you probably dont have any attribute to create a policy to give them users a corresponding u@newdomain.com address. I would go for a EMS script to do this. lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2011 6:40pm

I was afraid of that... Any suggestions on an EMS script? I'm fairly new to EMS and not sure how to make this work. The problem I'm having is that all the additional email addresses are in a single comma delimted attribute. I'd sure appreciate any help on getting a script built. Thanks.
August 2nd, 2011 11:57pm

What version of Exchange is this?lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2011 12:04am

We're in the process of migrating to 2010, but most of our users are still on 2007.
August 3rd, 2011 12:25am

how many users you have like that? -bpara
Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2011 1:15am

here you go. This is Exchange 2010 version # Add proxy addresses # change the Get-Mailbox statement in line 8 to select only a subset of mailboxes $AddressSearchedFor = "*@domain.com" $DomainToAdd = "@newdomain.com" #get mailboxes and iterate through Get-Mailbox -ResultSize Unlimited | foreach{ $_.Alias # .emailaddresses returns array # loop each email address for ($i=$_.EmailAddresses.Count;$i -ge 0; $i--) { $address = $_.EmailAddresses[$i] #Write-Host $address # look for SMTP addresses in source if ($address.SmtpAddress -like $AddressSearchedFor ) { # get the left part of address $a = [string] $address $b = $a.indexof("@") $a = $a.substring(5, $b-5 ) #Write-Host $ # Add SMTP address Write-host("Adding smtp adress: " + $a + $DomainToAdd ) # add address in the array $_.EmailAddresses.add("smtp:" + $a + $DomainToAdd) } # save changes $_ | Set-Mailbox -EmailAddresses $_.EmailAddresses } Write-Host } lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
August 3rd, 2011 1:17am

I've done some testing and I think this is going to work for my purposes. However, there are a few users who already have the @newdomain addresses so I need to include an exception so it does not error out trying to add an address that already exists. Thank you!!
Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2011 2:18pm

Hi, You need to add a loop before "# add address in the array" to compare all the smtp address in the mailbox account with the "$a + $DomainToAdd"Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
August 4th, 2011 3:18am

If users already have the @newdomain.com address, script will throw an error and continue. If you have many users you can change the line with Get-Mailbox to narrow down the scope of users to add addresses on. This will allow you to scroll up in the EMS window to see what happended during the run of the script. lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2011 6:14am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics