Creating multiple mailboxes using Exchange Management Shell

Share this:

In Today’s Tutorial we are going over a simple task which is to create several mailboxes using Exchange Management Shell. This Tutorial may be useful when creating a LAB and the same principle can be used for Distribution Groups and several other objects and the same applies to create Active Directory users for example.

Solution


The first step  is to define the initial password to all new mailboxes, let’s run the following cmdlet and on the new dialog box we need to make sure that we type in the desired password in the Password field. By the way, the User Name field it doesn’t matter so we just need to type something on it.

$Password = (Get-Credential).Password

image5

Now, it’s time to use a single line to create as many mailboxes as you want. Using the cmdlet listed below we can control the number of mailboxes (in the example we are creating 10 users, if you want 50, just change the 10 to 50). Also, we are adding a prefix for the new mailboxes (in the example we are using Argentina), and the UPN for the new mailboxes (in our example is @apatricio.info.

ForEach ($vNumber in 1..10) { New-mailbox (“Argentina” + $vNumber) –Password $Password –OrganizationUnit <OU-Path> –Database <Database-Name> –UserPrincipalName (“Argentina” + $vNumber +”@apatricio.info”) }

Note: The OrganizationUnit and Database are not mandatory ;

Time to see the cmdlet in action, and in the example bellow we are creating 10 users in the Argentina OU, and all the users start with Argentina.

image2

If you are skeptical about the process, you can always check the Exchange Management Console (Exchange Server 2010) or Exchange Admin Center (2013) to check it out the new mailboxes created.

image8

Conclusion


In this Tutorial we covered a simple cmdlet that allows any administrator to create several mailboxes using the same password using a single line in Exchange Management Shell.

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).

Related Post

How to create a DAG in Exchange Server 2013 SP1 wi... In this Tutorial we are going to use a new feature introduced in Exchange Server 2013 SP1 which is the capability to create a DAG object without an AA...
Error Property InvalidDatabaseCopiesAllowed In some scenarios when creating a Mailbox Database the error below may appear. This Tutorial was based on Exchange Server 2013 Service Pack 1 (CU4). P...
How to Export Recoverable Deleted Items and Purges... Hi there folks! In some situation during regular operations an user deletes something and the Operations/Exchange Admin has to work on the issue to r...
How to rebuild Exchange Server 2013 search catalog In this Tutorial we are going over the required steps to reset the Exchange Server 2013 search catalog. Depending of your environment the process to r...