0

I need to create lots of email aliases (more than I want to do manually), so I want to know if there's a way I can script the addition of aliases to existing mailboxes/users. I don't mind if I have to use powershell or an external tool or not.

For each existing user, I need to create a number of new email aliases.

I have, as an example:

Bernhard.Hofmann@domain.com

I then want to create:

Bernhard.Hofmann1@domain.com
Bernhard.Hofmann2@domain.com
Bernhard.Hofmann3@domain.com
Bernhard.Hofmann4@domain.com
Bernhard.Hofmann5@domain.com
...

Thanks

2 Answers2

3

When you say "alias" do you mean email address (because in Exchange parlance an alias and an email address are two different things)? If so, why not just add the email address to your Recipient Policy?

EDIT

If you want to add the new email address to all users then add the email address to your existing default Recipient Policy. If you want to add the email address to a subset of users then you'll need to create a new Recipient Policy using a filter that is applicable to this subset of users (an LDAP filter based on some attribute of these users, such as department or office for example).

http://support.microsoft.com/kb/319201

joeqwerty
  • 109,901
  • 6
  • 81
  • 172
  • 1
    Good start, but the user's question is about scripting. – jgoldschrafe Sep 21 '11 at 13:17
  • 1
    No, it's about creating/applying an email address to a large number of users to which the OP asked if there was a way to do it via scripting. Should I not have answered because my method doesn't use scripting (but is an appropriate method because you can't just add an email address to a user account, your Exchange server must be configured to be authoratative for the email address, which is accomplished by adding the email address to the Recipient Policy)? Just because my answer doen't involve scripting doesn't invalidate it as a correct and appropriate answer. – joeqwerty Sep 21 '11 at 13:30
  • My fault Joe, for not making my question clearer. I've edited the question to make it clear that each person needs a number of new aliases. – Bernhard Hofmann Sep 21 '11 at 16:21
  • @Bernhard - I'm not sure that you're convinced, but this is the way to go. Pay special attention to the bits about "replacement strings". These are what allow you to customize the front-end of the e-mail address (rather than just the domain suffixes). http://support.microsoft.com/kb/822447 – pk. Sep 21 '11 at 16:35
  • @pk: Thanks for the link. I use replacement strings in almost all of my Recipient Policies. We host email for a large number of customers and they all have different email address format requirements. One size does not fit all and replacement strings allow for quite a bit of flexibility. – joeqwerty Sep 21 '11 at 17:35
2

A few lines of powershell will do this for you:

$aliasname = Get-Mailbox -OrganizationalUnit "OUName" -ResultSize Unlimited $aliasname | Foreach-Object{ $_ | Set-mailbox -Alias }

This gets a list of all mailboxes in an OU called "OU Name" (you can change the filter to suit your needs) and then sets an alias on each these mailboxes. Obviously you can use the mailbox object to get the name, UPN etc to use as part of your alias if you wish.

Sam Cogan
  • 38,736
  • 6
  • 78
  • 114