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 remove a mailbox permanently By default when a mailbox is either disabled or removed it will show up as disconnected and it will stay there for the time defined in the Mailbox Dat...
How to renew Public Certificates in Exchange Serve... The process to renew Public Certificates in Exchange Server 2013/2016 is simple and you can get over with in less than 30 minutes. We are going to dem...
How to prepare Active Directory separately in Exch... In this Tutorial we are going over the process to prepare Active Directory which is a required step when deploying the first Exchange Server 2013 Serv...
Managing Send as and Send on Behalf to in Distribu... In this Tutorial we will go over the configuration required to configure both Send as and Send on Behalf of in Distribution Groups in Exchange Server ...