The script below will create a batch of Active directory users
in sequence. This is helpful when creating a batch of users in your AD
environment.
1. Open notepad
2. Copy and paste below text to notepad
3. Save the file with .vbs extension.
2. Copy and paste below text to notepad
3. Save the file with .vbs extension.
'------------ SCRIPT STARTS HERE--------------
'---------------------------------------------------------
'---------------------------------------------------------
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & _
objRootDSE.Get("defaultNamingContext"))
For i = 1 To 1000
Set objLeaf = objContainer.Create("User", "cn=Site01CoolGuy" & i)
objLeaf.Put "sAMAccountName", "Site01CoolGuy" & i
Set objContainer = GetObject("LDAP://cn=Users," & _
objRootDSE.Get("defaultNamingContext"))
For i = 1 To 1000
Set objLeaf = objContainer.Create("User", "cn=Site01CoolGuy" & i)
objLeaf.Put "sAMAccountName", "Site01CoolGuy" & i
objLeaf.Put "description", "I am the
Site01CoolGuy" & i
objLeaf.Put "displayname", "zzSite01CoolGuy" & i
objLeaf.Put "givenname", "Site01"
objLeaf.Put "sn", "CoolGuy" & i
objLeaf.Put "telephonenumber", "408555" & i
objLeaf.Put "wwwhomepage", "www.Site01CoolGuy" & i & ".com"
objLeaf.Put "physicaldeliveryofficename", "London" & i
objLeaf.Put "displayname", "zzSite01CoolGuy" & i
objLeaf.Put "givenname", "Site01"
objLeaf.Put "sn", "CoolGuy" & i
objLeaf.Put "telephonenumber", "408555" & i
objLeaf.Put "wwwhomepage", "www.Site01CoolGuy" & i & ".com"
objLeaf.Put "physicaldeliveryofficename", "London" & i
objLeaf.Put "userPrincipalName",
"Site01CoolGuy" & i & "@zenqa.net"
objLeaf.SetInfo
Objleaf.setpassword "Zenlab" & i
Objleaf.accountdisabled = False
Objleaf.setinfo
Next
WScript.Echo "1000 Users created."
objLeaf.SetInfo
Objleaf.setpassword "Zenlab" & i
Objleaf.accountdisabled = False
Objleaf.setinfo
Next
WScript.Echo "1000 Users created."
'-----SCRIPT ENDSS HERE--------------
0 comments :
Post a Comment