How to provision Recipients in Bulk in Exchange Server with PowerShell

Home > Blogs > Exchange Server > How to provision Recipients in Bulk in Exchange Server with PowerShell

How to provision Recipients in Bulk in Exchange Server with PowerShell

Like This Blog 0 Mike Pfeiffer
Added by September 18, 2013

When it comes to provisioning users in bulk there’s a couple of common things typically people are reading data out of text file, reading it out of a CSV file or basically just pulling out of Active Directory. Let’s take a look out of the AD scenario.

If I use:

Get-User –RecipientTypeDetails user

These are just the plain old users, those are all people out there in AD that do not have mailboxes.


So if I want to do this in bulk I could just pipe this over to another command and create these mailboxes.

In that case you would have a script that would run, maybe the AD guys are responsible for provisioning Active Directory user accounts and your job is only to create the mailboxes. Maybe once a week you could go out and scan on a certain OU and create mailboxes from there.

You could use:

Get-User –RecipientTypeDetails user –OrganizationalUnit sales


I’ve got four sales user out there that don’t have mailboxes and I could continue piping that over to enable mailbox

Get-User –RecipientTypeDetails user –OrganizationalUnit sales | Enabel-Mailbox

What will happen is, it will create all of those four mailboxes for me in one shot.


That’s kind of one method you could use to bulk provision users.

Another method would be from a CSV file. We have the ability to do this from any kind of external file, but the most common use for this is a CSV. The reason is because it allows you to define multiple settings.

For example, in this file I’ve only got three properties‑‑name, alias and user principle name.


But you could populate this with multiple columns for all kinds of different settings.

Basically you just read this in. Loop through each row in the CSV and pass these details into the cmdlet parameters as needed.

Reading this data into the shell, CSV file is as simple as doing an import CSV.


You could see there that the whole CSV gets pulled into the shell. As I loop through each one of these records I can access each individual property name.

For example, if I pipe these before each object, the dollar sign underscore would represent each row as it kind of passes over the pipeline and you can access the column headers using the dot notation.alias for example.

Here are all the aliases.


Here’s all the names.


While you’re inside this script lock {   } you can access all of those properties and kind of pass them into the command.

Let me clear this and start from scratch. What I want to do first is actually create a password and really what I want to do here is show you this in ISE so it’s a little easier to read.

I’m going to do an import CSV, grab the users .csv and pipe that over before each object.


So first of all I need to create that secure string password object so I’m going to do a new mailbox because these users don’t exist in AD so I’m going to do a $password as follows:


So it’s going to be a common password assigned to all of these new users.

I’m going to do a new -mailbox. I will assign the name property to the name parameter, the alias to the alias and user principle name. Finally they’re all going to have the same common password.


Since they all have the same common password, I want to do a reset password on next logon, $true.


You see that I’m kind of running off to the right of the screen here, getting hard to read. New mailbox actually has I think somewhere between 50 and a hundred parameters, so in theory you could run through this and continue scrolling right for a really long time. If you want to break this up a little bit, you can use PowerShell’s line continuation character which is the back tick [ ` ].


So just like this you could break this command up.


That’s a little bit easier to read.

Let me go ahead and run this. Bring the output pane up so we could see. Go ahead and test this code. Hit start and there it goes creating all the mailboxes for me that I’m passing those values in straight from the CSV file.


That’s just a couple of quick ways you can bulk provision recipients and of course you can use the get content cmdlet as well to read data in from a text file.


Videos You May Like

Agile Methodology in Project Management

0 185 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

An Overview of Office 365 – Administration Portal and Admin Center

0 960 3

This is part 1 of our 5-part Office 365 free training course. In this Office 365 training video, instructor Spike Xavier introduces some of the most popular services found in Microsoft Office 365 including the Admin Portal and Admin Center. For instructor-led Office 365 training classes, see our course schedule: Spike Xavier SharePoint Instructor – … Continue reading An Overview of Office 365 – Administration Portal and Admin Center

Creating Users and Managing Passwords in Microsoft Office 365

0 809 5

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.   For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365    

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.