Here is a script I use to bulk create accounts. It includes a section for creating a mailbox...

Code:

Break On

; Distinguished Name of the OU where you want to create the accounts
$objOU = GetObject("LDAP://OU=WI06,OU=Accounts,DC=your,DC=domain,DC=com")

; Tab-delimited text file containing the names for the accounts to create
$sUserList = @SCRIPTDIR+"\AD_WI06.txt"

If Not Open(1,$sUserList)
$sUser = ReadLine(1)
While Not @ERROR
$Err=''
$sUser = Split($sUser,Chr(9))
$sFullName = Trim(Join(Split($sUser[0],'"'),''))
$sLastName = Trim($sUser[1])
$sFrstName = Trim($sUser[2])
$sMdleName = Trim($sUser[3])
$sSAMName = Trim($sUser[4])

; General Tab
$objUser = $objOU.Create("User","cn="+Join(Split($sFullName,","),"\,"))
$objUser.Put("givenName",$sFrstName) ; First name
If Len($sMdleName) $objUser.Put("initials",$sMdleName) EndIf ; Middle initial
$objUser.Put("sn",$sLastName) ; Last name
$objUser.Put("displayName",$sFullName)
$objUser.Put("description","User Account")
$objUser.Put("physicalDeliveryOfficeName","MA07")
;$objUser.Put("telephoneNumber","")

; Account Tab
$objUser.Put("userPrincipalName",$sFrstName+"."+$sLastName+"@@domain.com")
$objUser.Put("sAMAccountName",$sSAMName)

; Profile Tab
$objUser.Put("scriptPath","rz_logon.bat")

; Telephones Tab
;$objUser.Put("homePhone","")

; Address Tab
$objUser.Put("c","US") ; Country
$objUser.Put("countryCode",840)
$objUser.Put("streetAddress","66 Sprague Street")
$objUser.Put("l","Hyde Park") ; City
$objUser.Put("st","MA") ; State
$objUser.Put("postalCode","02136")

; Create Mailbox
$msExchHomeServerName = "/O=domain/OU=World HQ/cn=Configuration/cn=Servers/cn=OH01MS42"
$homeMDB = "CN=OH01MS42 SG4 MS5,CN=OH01MS42 SG4,CN=InformationStore,CN=OH01MS42,"+
"CN=Servers,CN=World HQ,CN=Administrative Groups,CN=domain,CN=Microsoft "+
"Exchange,CN=Services,CN=Configuration,DC=domain,DC=com"
$objUser.Put("msExchHomeServerName",$msExchHomeServerName)
$objUser.Put("homeMDB",$homeMDB)
$objUser.Put("mDBUseDefaults",TRUE)
$objUser.Put("mailnickname",$sFrstName+"."+$sLastName)
$objUser.Put("mail",$sFrstName+"."+$sLastName+"@@domain.com")

; Commit changes to Active Directory
$objUser.SetInfo
If @ERROR $Err=$Err+','+@ERROR EndIf

; Set the password
$objUser.SetPassword("domain1")
If @ERROR $Err=$Err+','+@ERROR EndIf

; Enable "Change password on next logon" flag
$objUser.Put("userAccountControl","512")
$objUser.Put("pwdLastSet",0)
$objUser.SetInfo
If @ERROR $Err=$Err+','+@ERROR EndIf

; Place the user in the appropriate groups (must have DN of the groups)
$objGroup = GetObject("LDAP://CN=group,OU=Accounts,DC=your,DC=domain,DC=com")
$objGroup.Add($objUser.ADsPath)
If @ERROR $Err=$Err+','+@ERROR EndIf

$objGroup = GetObject("LDAP://CN=distributionList,OU=Distribution Lists,OU=Exchange,DC=your,DC=domain,DC=com")
$objGroup.Add($objUser.ADsPath)
If @ERROR $Err=$Err+','+@ERROR EndIf

$sFullName + " " + $Err ?

$sUser = ReadLine(1)
Loop
Else
"Error "+@SERROR+" opening "+$Database ?
Exit
EndIf

Get $

Exit 0