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

Agile Methodology in Project Management

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

Creating Users and Managing Passwords in Microsoft Office 365

0 732 3

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    

JavaScript for C# Developers – September 24, 2014

0 501 3

Is JavaScript worth taking the time to learn if I’m a server-side .NET developer? How much of C# carries over to JavaScript? In this recorded video from Dan Wahlin’s webinar on September 24,2014, Dan answers these questions and more while also discussing similarities between the languages, key differences, and the future of JavaScript (ES6). If … Continue reading JavaScript for C# Developers – September 24, 2014

Write a Comment

Share your thoughts...

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