How to Add a New E-Mail Address in Exchange 2007 using Power Shell
Power Shell is very handy when it comes to managing Exchange 2007. Adding new email addresses for existing mailbox users is very common task for exchange administrators. Unfortunately there is no one cmdlet which would allow it. Below I will present a simple script, which is a combination of Get-Mailbox and Set-Mailbox cmdlets.
[PS] C:\Windows\System32>Get-Mailbox -Identity "acte\mroot" | fl EmailAddresses
EmailAddresses : {smtp:mroot@acte.local, SMTP:mroot@acte.pl}
[PS] C:\Windows\System32>$tmpMailbox = Get-Mailbox -Identity "acte\mroot"
[PS] C:\Windows\System32>$tmpMailbox.EmailAddresses.Add("kz@acte.pl")
[PS] C:\Windows\System32>Set-Mailbox -Instance $tmpMailbox
[PS] C:\Windows\System32>Get-Mailbox -Identity "acte\mroot" | fl EmailAddresses
EmailAddresses : {smtp:kz@acte.pl, smtp:mroot@acte.local, SMTP:mroot@acte.pl}
The first line displays currently assigned email addresses to a mailbox object, which is identified by “acte\mroot”, the “fl EmailAddresses” means that we only want to display EmailAddresses property of mailbox object.
[PS] C:\Windows\System32>$tmpMailbox = Get-Mailbox -Identity "acte\mroot"
In above lines we assign mailbox object to a variable.
[PS] C:\Windows\System32>$tmpMailbox.EmailAddresses.Add("kz@acte.pl")
Here we add new email address to EmailAddresses collection.
[PS] C:\Windows\System32>Set-Mailbox -Instance $tmpMailbox
Set-Mailbox cmdlet saves our changes
[PS] C:\Windows\System32>Get-Mailbox -Identity "acte\mroot" | fl EmailAddresses
Lastly we verify that new email address was added.
- Krystian Zieja's blog
- Login or register to post comments



Recent comments
48 weeks 6 days ago