How to add mailboxes to existing AD accounts ...

How to add mailboxes to existing AD accounts ...

Post by Tim Staddo » Wed, 10 Nov 2004 02:02:44


Hi,

I'm a little bewildered by the array of options as to how
to add Exchange 2000 accounts to existing users by script.
To make life easier there's only one Exchange server.

There's three I can think of: ADSI, CDO, and LDIF. And to
be brutally frank, Microsoft don't exactly explain any of
the pros and cons of each option.

Being a bit of a code junkie, I already have a VB script
which pulls out the entire list of users in Active
Directory and reports the mail store if found, plus
several other frequently used fields.

Could I modify it like this:

Sub CreateMBoxes(oObject)
Dim oUser, hdbCurrent, hdbDefault
hdbCurrent = ""
hdbDefault = "CN=Mailbox Store (SERVER), .... ,DC=com"

For Each oUser in oObject
Select Case oUser.Class
Case "user"
hdbCurrent=oUser.HomeMDB

if hdbCurrent = "" and len(oUser.SN) > 1 then
oUser.CreateMailbox hdbDefault
oUser.Put "msExchUserAccountControl",2
oUser.SetInfo
end if
end select
next
end sub

or would it be better if I simply jiggered around with
LDIFs?
 
 
 

How to add mailboxes to existing AD accounts ...

Post by Andy Web » Wed, 10 Nov 2004 14:21:00

LDIF can't create mailboxes, nor can ADSI.

CDO is the only way to actually run the mailbox creation.