Adding new User through AD / ldifde / creating mailbox ?



During the year I add teachers at our school through AD Users and
Computers. At the end it is checked to add a mailbox for them on our
exchange server. Of course this works great and they are done.

I use ldifde to import all of our students (100's at a time) and that
works great but they do not get email.

Now I want to use ldifde to batch import a huge group of new teachers
but I'm not sure of the attributes I need to add to my .ldf file. Here
is an example which works fine.

dn: CN=Doe\, Jane,OU=Teachers,OU=BA,OU=Schools,OU=MySchool
changetype: add
objectClass: user
cn: Doe, Jane
sn: Doe
givenName: Jane
description: BA Teacher
distinguishedName: CN=Doe\,
Jane,OU=Teachers,OU=BA,OU=Schools,OU=MySchool Users,DC=myschool,DC=org
displayName: Doe, Jane
name: Doe, Jane
userPrincipalName: (e-mail address removed)
homeDirectory: \\fs1\doej$
HomeDrive: H:
scriptPath: BAteacher.bat
SAMAccountName: doej

What do I need to add to this so they get an Exchange mailbox? I'm
guessing when you just check off the bax it adds a whole new set of
attributes but just not sure which ones! Thanks for any help on this.


Laura E. Hunter [MVP]

Mailbox-enabling users via LDIF is pretty infeasible because it involves
manipulating a binary value, the msExchMailboxSecurityDescriptor attribute.
Better to use VBScript or the exchmbx command-line tool that's downloadable

exchmbx will work in this fashion:
exchmbx -b "<UserDN>" -cr "<server>:<storage group>:<mail store>"
Or alternatively, run the following command:
exchmbx -b <UserDN> -cr "<Home MDB URL>"
To mailbox enable the user joe with a mailbox on Exchange Server SRV1,
Storage group SG1, and mailbox store DB1, execute the following command:
exchmbx -b "cn=joe,cn=users,dc=mycompany,dc=com" -cr "srv1:sg1:db1"

If you want to mailbox enable multiple users at once, remove the -b option
from the parameter list and pipe the distinguished names into ExchMbx from
another tool or from a file. Run exchmbx /? for usage details.

A sample VBScript to mailbox-enable a user is as follows:

' This code creates a mailbox for a user.
strUserDN = "<UserDN>" ' e.g. cn=jsmith,cn=Users,dc=rallencorp,dc=com
strHomeMDB = "<Home MDB DN>"
' e.g. CN=Mailbox Store (SERVER),CN=First Storage Group,CN=InformationStore,
' CN=SERVER,CN=Servers,CN=First Administrative Group,CN=Administrative
' CN=RALLENCORPMAIL,CN=Microsoft Exchange,CN=Services,
' CN=Configuration,DC=rallencorp,DC=com"
' ------ END CONFIGURATION ---------
set objUser = GetObject("LDAP://" & strUserDN)
objUser.CreateMailBox strHomeMDB
Wscript.Echo "Successfully mailbox-enabled user."


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question