Master Exchange 2007

powershell, automation & more…

Bulk Create Users for Exchange 2007 testing

Posted by shauncroucher on August 5, 2009


I wrote a script the other day because I wanted to test a mailbox store with a few hundred mailboxes.

The script below will create as many mailboxes as you have added to a CSV file.

First create a CSV file with the following column names:

Name, Alias, FirstName, LastName, UPN, Domain, Password

Now, you can use Excel or other tool to easily replicate a row of data, I typically create a user called “Employee1” and then pull this down to a few hundred rows. Of course, you can also record new user details to a CSV and use the script below to bulk create them.

Place the CSV in the same directory as the following cmdlet and run.

Import-Csv recipients.csv | foreach { $Password = ConvertTo-SecureString $_.password -asplaintext -force;$UPN = $_.UPN+$_.Domain; New-Mailbox -alias $_.Alias -name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $UPN -Database “mailbox database” -OrganizationalUnit Users -Password $Password}

* Note I have had situations where a CSV file I saved using Excel 2007 could not be read by the Import-CSV command. Verify that the file is readable by running just Import-CSV <filename.csv>, it should return your data in the correct columns. If it does not, I would advise opening the csv in notepad and then saving. this usually fixes the issue.

Shaun

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: