create mailboxes from csv file. variable first name, sure name, password and Origanizational unit

i had to create bulk mailboxes on exchange 2010 in my hosted environment, so i search on the internet for scripts and put them together to fit my environment.

so i wanted to use, first name, surename, Display name, username, variable password and put the users in certain OU map in AD

so my CSV file will look somehing like this

fname,lname,username,password,OUPath
els,konnick,els.konnick,Test123!,domain.local/customer/cust01

here is the script you can copy paste in a notepad and save it as .ps1


#csv file with fields:fname,lname,username,password,OUPath

import-csv ‘C:\pathtocsvfile\userlist.csv’ | Foreach-object {

$Fname = $_.FName
$LName = $_.LName
$DisplayName = “$FName $LName”
$User = $_.Username
$Password = convertto-securestring $_.password -asplaintext -force
$OUPath = $_.OUPath

New-Mailbox -UserPrincipalName $User@yourdomain.com -Alias $User -Database “Mailbox Database” -Name $DisplayName -Password $Password -FirstName $FName -LastName $LName -DisplayName $DisplayName -OrganizationalUnit $OUPath
}


if you need the rest of the script to create global address list, addres policy, address book, accepted domain

then let me know and i will put it in my blogpage also.

Advertisements

www.vdssystems.be

Tagged with: , , , ,
Posted in Exchange, Microsoft

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

Archives
%d bloggers like this: