Creating multiple mailboxes using Exchange Management Shell

Share

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 thumb Creating multiple mailboxes using Exchange Management Shell

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 thumb Creating multiple mailboxes using Exchange Management Shell

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 thumb Creating multiple mailboxes using Exchange Management Shell

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

 Creating multiple mailboxes using Exchange Management Shell

Anderson Patricio is a Canadian Exchange Server MVP and MCSM (Solutions Master) and he contributes to the Microsoft Community with articles, tutorials, blog posts, forums and book reviews. He is a regular contributor at MSExchange.org, AndersonPatricio.ca (English) and AndersonPatricio.org (Portuguese).
You can connect with Anderson on Twitter , Facebook, and Google+.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>