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

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", "[email protected]"
objUser.AccountDisabled = false
objUser.put "userPassword", "Pa55word"

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.