Allow me to preface this with that it’s a Partial solution for the above question. AND it only works with Exchange 2007. Why? On a cmdlet level there’s no –TemplateInstance parameter in Exchange Server 2010 (it was present in Exchange Server 2007 but removed for the next version for some reason).

the online help confirms this (

It becomes a two stage process. First using Powershell2.0 and the AD module you will create a new user from an existing user or template account. Then if you want to then enable-mailbox the user you’ve just created from a template mailbox you can do that in a second step. let’s cover this in stages.. First the new user object creation. Needs to be done in Powershell 2.0 as we’ll be using the New-ADUser Cmdlet.

First rev up a Powershell 2.0 prompt while logged in as a domain admin. Ensure the Active Directory module is loaded via the Import-Module ActiveDirectory.

First we’ll need to set a variable to store the user object’s name that we’ll reference

$userInstance = Get-ADUser -Identity “saraDavis”

Now we’ll create the new user account from the variable..

New-ADUser -SAMAccountName “ellenAdams” -Instance $userInstance -DisplayName “EllenAdams” -

Note the above syntax is the bare minimum, I would use more to set other attributes. like this..

New-ADUser -SAMAccountName “ellenAdams” -Instance $userInstance -DisplayName “EllenAdams” –UserPrincipalName –FirstName Ellen –LastName Adams -Path ‘CN=Users,DC=Contoso,DC=com’

Now that the new user object is created, let’s rev up EMS and create a mailbox for the new user from a designated template.

Obviously, every recipient object is different, so you might be wondering why you should even bother using a template. Well, even though each recipient object has unique properties, there are also aspects of the object that are going to be the same for other objects. For example, every employee in your building is probably going to have the same mailing address.

If you are still questioning the usefulness of a recipient template, then you should keep in mind that you aren’t limited to only creating one template. You can create as many different templates as you need. For example, you could create a separate template for each department.

Creating a Template

Creating a new template is really easy to do. You can create a template based on any type of recipient other than a public folder. Most often though, you would probably create templates to help you to create mailboxes. With that in mind, you must begin the process by creating a template mailbox. To do so, just set the mailbox up in the same way that you want mailboxes that are based on it to be set up. Fill in any Active Directory properties that you want to be populated in clone mailboxes, and leave out any optional information that is going to be different for each recipient.

After you have created a template mailbox, you have to designate it as a template.  For that you will have to use the Exchange Management Shell. Simply enter the following command:

$Template = Get-Mailbox <”template name”>

For example, in my own organization, I created a mailbox named Template. Therefore, the command looks like this:

$Template = Get-Mailbox “Template”

You can see what the command looks like in Figure A.


Click here to find out more!

Figure A

This is what the $Template command looks like.

Now that you have created a template, you can create a mailbox based on that template. The procedure for doing so is almost identical to the technique that you would use to create a new mailbox through the Exchange Management Shell. The difference is that you have to reference a template instance. I will talk more about template instances in Part 2, but for now our template instance is named Template$. To create a new mailbox based on the template instance, use this command:

New-Mailbox –Name <”Name”> -UserPrincipalName <”User principal name”> -Database <”Server namemailbox database”> -OrganizationalUnit <”OU”> -TemplateInstance $Template

For example, if you wanted to create a mailbox for a user named User3, the command might look like this:

New-Mailbox –Name ”User3” -UserPrincipalName ”User3” -Database ”Server1Mailbox Database” -OrganizationalUnit ”OU” -TemplateInstance $Template

Some Additional Recommendations

As you can see, creating a mailbox based on a template isn’t difficult. If you are going to use templates though, there are a couple of recommendations that I would make. For starters, I would recommend that you hide your templates from the address book. That way, users won’t see the template on the Global Address List.

Another recommendation that I would make would be to adopt a naming convention for your template recipients. For example, you might use the same first few characters for the name of each one. (TEMP1, Temp2, etc.) The reason for this is that all of the templates will be grouped together when you view the recipients through the Exchange Management Console. It also makes it easy to create a filter that displays only template recipients.


Hopefully, you can see how creating a template up front can save time in creating recipient objects later on. We aren’t done yet though. In the next part of this series, I will show you how you can use a template to create multiple recipients simultaneously.


UPDATES – 7/9/2012

It was brought to my attention by a coworker that I had incorrectly tagged this as Exchange 2010 when in fact it only works in Exchange 2007. I’ve updated the tags and added the disclaimer and reasoning at the top of this post. Thank for the catch John! Not the first or last time i’ll be wrong!

« »