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:pathtocsvfileuserlist.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.
Leave A Comment