- Details
- Written by: Marek
- Category: PC Stuff
- Hits: 1850
This script will populate an AD User, can be looped to generate many users.
[Begin Script]
' Replace Perth with any root level ou
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://ou=Perth," & _
objRootDSE.Get("defaultNamingContext"))
For i = 1 To 15
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.SetInfo
objLeaf.ChangePassword "", "i5A2sj*!"
objLeaf.AccountDisabled = FALSE
objLeaf.SetInfo
Next
WScript.Echo i-1 & " Users created."
Set objContainer = GetObject("LDAP://ou=Perth," & _
objRootDSE.Get("defaultNamingContext"))
For i = 1 To 15
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.SetInfo
objLeaf.ChangePassword "", "i5A2sj*!"
objLeaf.AccountDisabled = FALSE
objLeaf.SetInfo
Next
WScript.Echo i-1 & " Users created."
[End Script]
[Begin Script]
strContainer = "ou=Perth"
strUserName = "EzAdUser"
strUserName = "EzAdUser"
'***********************************************
'* Connect to a container *
'***********************************************
Set objRootDSE = GetObject("LDAP://rootDSE")
If strContainer = "" Then
Set objContainer = GetObject("LDAP://" & _
objRootDSE.Get("defaultNamingContext"))
Else
Set objContainer = GetObject("LDAP://" & strContainer & "," & _
objRootDSE.Get("defaultNamingContext"))
'* Connect to a container *
'***********************************************
Set objRootDSE = GetObject("LDAP://rootDSE")
If strContainer = "" Then
Set objContainer = GetObject("LDAP://" & _
objRootDSE.Get("defaultNamingContext"))
Else
Set objContainer = GetObject("LDAP://" & strContainer & "," & _
objRootDSE.Get("defaultNamingContext"))
End If
'***********************************************
'* End connect to a container *
'***********************************************
'***********************************************
'* End connect to a container *
'***********************************************
Set objUser = objContainer.Create("user", "cn=" & strUserName)
objUser.Put "sAMAccountName", strUserName
objUser.SetInfo
objUser.AccountDisabled = FALSE
objUser.ChangePassword "", "Password123"
objUser.SetInfo
[Begin Script]
objUser.Put "sAMAccountName", strUserName
objUser.SetInfo
objUser.AccountDisabled = FALSE
objUser.ChangePassword "", "Password123"
objUser.SetInfo
[Begin Script]