Bulk Mailbox Provisioning with Random Passwords – Easy PowerShell tricks for Exchange Server 2010

Home > Blogs > Exchange Server > Bulk Mailbox Provisioning with Random Passwords – Easy PowerShell tricks for Exchange Server 2010

Bulk Mailbox Provisioning with Random Passwords – Easy PowerShell tricks for Exchange Server 2010

Like This Blog 0 Mike Pfeiffer
Added by August 13, 2012

In a recent Exchange 2010 class here at Interface, we had a discussion on the topic of provisioning mailboxes with PowerShell. One of the questions that came up is how would you go about creating a bulk mailbox provisioning script that would generate an initial secure random password for each mailbox. As it turns out, this is fairly easy to do with a few PowerShell tricks.

I've written a script for this that will create mailboxes in bulk using a CSV file. After the mailboxes have been created, a report is generated that contains the details for each mailbox, along with the associated password. You can download the script here; the steps on how to use it are outlined below.

To use this script, you need to create a CSV file that will be used to create the mailboxes. The column headers in the CSV file should map to the New-Mailbox cmdlet parameter names you would normally use when creating a mailbox. For this example, I am going to use the following parameters and add them as columns in the CSV; Name, Alias, UserPrincipalName, Database and OrganizationalUnit. Obviously, I won't need to provide a password column as the script will handle that part.

Each field will contain the input value for each parameter. You can create the file in excel and save it in CSV format. Here's a screenshot of the CSV file (saved as c:\users.csv) I am going to use for this example:

The script accepts three parameters; PasswordLength, NonAlphanumericCharacters, and ReportFile. The PasswordLength and NonAlphanumericCharacters parameters are optional parameters. The default password length is set to 8 characters, and the default number of non alpha numeric characters is set to 0. You can override these values as needed to meet your AD password policy requirements. The ReportFile parameter is required and should be the full path to where you want the report to be saved.

Once your CSV file is setup, use the following syntax to create the mailboxes in bulk:

[PS] C:\>.\BulkAddRandom.ps1 -CSVFile c:\users.csv -ReportFile c:\report.csv

After the script is run, open the report file saved to the ReportFile directory to view the password assigned to each mailbox:

Now you can use the report to distribute the passwords to the new users.

Mike Pfeiffer – Microsoft MVP
Interface Technical Training – Director of Unified Communications


Training courses Mike teaches in Phoenix, AZ and online with RemoteLive
Exchange Server Training – EXCH2010: Designing and Implementing Exchange Server 2010
PowerShell Training – PS350EX: PowerShell for Exchange Server
Microsoft Lync Server Training – 10533: Deploying Configuring and Administering Lync Server 2010

Video Training Courses by Mike Pfeiffer:
Exchange Server Course Video – EXCH2010 Designing and Implementing Microsoft Exchange Server 2010
PowerShell Course Video – PS350EX: PowerShell for Exchange Server

Videos You May Like

A Simple Introduction to Cisco CML2

0 3852 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

Cable Testers and How to Use them in Network Environments

0 713 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

Encrypting a USB Flash Drive in Windows 10

1 451 3

Hi, my name is Mike Danseglio. I’m an instructor here at Interface Technical Training. I want to talk a little bit about encrypting USB flash drives with Windows 10. The concept of protecting data when it’s on a USB flash drive is not a new concept. BitLocker 2-day instructor-led training is now available at Interface: … Continue reading Encrypting a USB Flash Drive in Windows 10

Write a Comment

Share your thoughts...

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