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.

001-AD-Provision-Recipients-in-Bulk

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

002-OU-AD-Provision-Recipients-in-Bulk

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.

003-OU-AD-Provision-Recipients-in-Bulk

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.

004-csv-file-Provision-Recipients-in-Bulk

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.

005-csv-file-Provision-Recipients-in-Bulk

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.

006-csv-file-Provision-Recipients-in-Bulk

Here’s all the names.

007-name-csv-file-Provision-Recipients-in-Bulk

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.

008-name-csv-file-Provision-Recipients-in-Bulk

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:

009-name-csv-file-Provision-Recipients-in-Bulk

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.

010-name-csv-file-Provision-Recipients-in-Bulk

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

011-csv-file-Provision-Recipients-in-Bulk

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 [ ` ].

012-csv-file-Provision-Recipients-in-Bulk

So just like this you could break this command up.

013-break-up-command-csv-file-Provision-Recipients-in-Bulk

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.

014-runbreak-up-command-csv-file-Provision-Recipients-in-Bulk

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

A Simple Introduction to Cisco CML2

0 3901 0

Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2

Creating Dynamic DNS in Network Environments

0 645 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader teaches how to create Dynamic DNS zones in Network Environments. Video Transcription: Now that we’ve installed DNS, we’ve created our DNS zones, the next step is now, how do we produce those … Continue reading Creating Dynamic DNS in Network Environments

Cable Testers and How to Use them in Network Environments

0 731 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments

Write a Comment

Share your thoughts...

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