Anyone know VBScript????????

JoshS

Registered
I need some help with VBScript. Does anyone know how?

If so.......

I have created 3 OU's. In 2 of those OU's i have to create 3 users each. I can get it to create 3 in the first OU but when it tries to create the 3 users in the 2nd OU I get a error message.:banghead:

I have tried to create the users 5 different ways and its not working.:banghead:

I will post a copy of the script and error message.
Any help is greatly appreciated.:bowdown:
 
Option Explicit
'On Error Resume next



'Sub subuser1
Dim objRootDSE
Dim objContainer
Dim objLeaf
Dim i
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://OU=Accounting," & _
objRootDSE.Get("defaultNamingContext"))

For i = 1 To 3
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.SetInfo
Next

WScript.Echo "3 Users created in Acct."
'End Sub

'Sub subusers
Dim objRootDSE1
Dim objContainer1
Dim objLeaf1
Dim i1
Set objRootDSE1 = GetObject("LDAP://rootDSE")
Set objContainer1 = GetObject("LDAP://OU=Accounting," & _
objRootDSE1.Get("defaultNamingContext"))

For i1 = 1 To 3
Set objLeaf1 = objContainer1.Create("User", "cn=UserNo" & i1)
objLeaf1.Put "sAMAccountName", "UserNo" & i1
objLeaf1.SetInfo
Next

WScript.Echo "3 Users created in Accounting"
'End Sub
 
Option Explicit
'On Error Resume next



'Sub subuser1
Dim objRootDSE
Dim objContainer
Dim objLeaf
Dim i
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://OU=Accounting," & _
objRootDSE.Get("defaultNamingContext"))

For i = 1 To 3
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.SetInfo
Next

WScript.Echo "3 Users created in Acct."
'End Sub

'Sub subusers
Dim objRootDSE1
Dim objContainer1
Dim objLeaf1
Dim i1
Set objRootDSE1 = GetObject("LDAP://rootDSE")
Set objContainer1 = GetObject("LDAP://OU=Information Technology," & _
objRootDSE1.Get("defaultNamingContext"))

For i1 = 1 To 3
Set objLeaf1 = objContainer1.Create("User", "cn=UserNo" & i1)
objLeaf1.Put "sAMAccountName", "UserNo" & i1
objLeaf1.SetInfo
Next

WScript.Echo "3 Users created in IT"
'End Sub

Oops LOL
There. THis is my script. and it doesn't work
 
lol I just called my coworker over to look at it. He knows VBScript, I just know C#
 
Back
Top