Subscribe to Windows IT Pro
December 14, 2007 12:00 AM

Q. Is there a script I can use to add a new Active Directory (AD) user via an LDAP connection?

Windows IT Pro
InstantDoc ID #97816
Rating: (0)
A. Yes there is. The script below creates a new user (“Bob Bobbington”) through an LDAP connection and adds the user to the “Users” container.

Set objOU = GetObject("LDAP://CN=Users,DC=savilltech,DC=net")
Set objUser = objOU.Create("User", "cn=Bob Bobbington")
objUser.Put "sAMAccountName", "Bob"
objUser.Put "displayName", "Bob Bobbington"
objUser.Put "name", "Bob Bobbington"
objUser.Put "givenName", "Bob"
objUser.Put "sn", "Bob"
objUser.Put "department", "IT"
objUser.Put "mail", "bob@bob.com"
objUser.SetInfo
objUser.AccountDisabled = false
objUser.put "userPassword", "Pa55word"
objUser.SetInfo

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.