Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sequential users in active directory

Status
Not open for further replies.

justcgi

Technical User
Oct 10, 2005
4
US
Hello,

How can I add sequential users in active directory
(like: frank1, frank2, frank3… frank99,
frank100), with only one step,
without adding them one by one?
thanks,
 
You could use a VBS script, just create a loop for something like this, and amend the icount into the username value.

Code:
Set oRoot = GetObject("LDAP://rootDSE")
Set oDomain = GetObject("LDAP://" & oRoot.Get("defaultNamingContext"))
Set oOU = oDomain.Create("organisationalUnit", "ou=AutomaticIDUsers")
oOU.Put "Description", "Automaictally Created Users"
oOU.SetInfo

strAcNamePref="Neil"
intNumAc=5
i=1

DO WHILE i<intNumAc+1

strAcNameWithID=strAcNamePref&i
Set oUser = oOU.Create("Users", "cn="&strAcNameWithID)
oUser.Put "sAMAccountName", strAcNameWithID
oUser.Put "Description", "Created by script"
oUser.SetInfo

oUser.SetPassword "Abc"&i

oUser.AccountDisabled = FALSE
oUser.SetInto

i=i+1
LOOP

Hope this Helps.

Neil J Cotton
njc Information Systems
Systems Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top