Is there a way to create a mail-enabled user account in Windows 2000 with a VB script.
I wrote a script that creates the account, places the account in the right OU and enabled it.
I can't figure out the mail-enable part.There must be a way to do this all in one script.
Thanks for your quick response nbishoop1979,
I am familear with this site (I learn a lot on VBScript from it) but I don't want to do it with CSVDE or Excel.
I just want someone to execute the script and the user account will be complete (user enable, password, mail enable etc')
are you still seeking a solution to this? i can help out with some vbscirpt code if you still need it.
kris.
ronenshabtay
ASKER
Kristinaw,
I manage to write a code that do the job (following is a copy of it) but I will be very hapy
if you could look at it an post your comments or share me with your own codes. I willing
to give the points for useful comments or codes.
Ronen
here is my code:
' VBScript to create an OU called QA38Users
' VBSCript then creates, enable and creates mailbox
' to xx Users in OU QA38Users
' ===============================================
Option Explicit
Dim objRoot, objDomain, objOU, objContainer, objUser, objRootDSE
Dim strContainer, strLastUser, strName, strDNSDomain, intCounter, intAccValue, intUser
Dim account, mbxDN, exchUser, objLeaf
strName ="TestUser"
Set objRoot = GetObject("LDAP://rootDSE")
Set objDomain = GetObject("LDAP://" & objRoot.Get("defaultNamingContext"))
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objOU=objDomain.Create("organizationalUnit", "ou=QA38_Test_Users")
objOU.Put "Description", "QA38 Domain Users"
objOU.SetInfo
Set objContainer = GetObject("LDAP://OU=QA38_Test_Users," & _
objRootDSE.Get("defaultNamingContext"))
For account = 1 To 20
Set objLeaf = objContainer.Create("User", "cn=" & strName & account)
objLeaf.Put "sAMAccountName", strName & account
objLeaf.SetInfo
intUser = intUser +1
Next
WScript.Echo intUser & " Users created "
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
strContainer = "OU=QA38_Test_Users,"
intAccValue = 512
strContainer = strContainer & strDNSDomain
set objOU =GetObject("LDAP://" & strContainer )
intCounter = 0
For each objUser in objOU
If objUser.class="user" then
objUser.Put "userAccountControl", intAccValue
objUser.SetInfo
intCounter = intCounter +1
strLastUser = objUser.Get ("name")
End if
next
WScript.Echo intCounter & " Accounts Enabled. Value " _
& intAccValue
mbxDN = "CN=Mailbox Store (QA-41),CN=First Storage Group,CN=InformationStore,CN=QA-41," & _
"CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=QA38," & _
"CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=qa38,DC=xosoft,DC=com"
For account = 1 To 20
Set exchUser = objContainer.Create("User", "cn=" & strName & account)
exchUser.CreateMailbox mbxDN
exchUser.SetInfo
intUser = intUser +1
Next
WScript.Quit
kristinaw
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
PAQ - Points Refunded
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
http://www.computerperformance.co.uk/Logon/VBScript/VBScript_Exchange_create_mailboxes.htm