Using Templates to Create Exchange Recipient Objects, Part 1
When I was a network administrator many moons ago, one of my least favorite tasks was setting up new users. It wasn’t really that it was such a bad job, it’s just that the process was tedious and boring. Today, the same could be said about manually setting up new Exchange Server mailboxes. The good news though, is that you don’t have to setup mailboxes manually. You can use a template to do a good bit of the work for you.
Why Use a 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.
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 name\mailbox 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 ”Server1\Mailbox 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.