Help Creating User in AD using script

By elmaestro2001 ·
Hello Guys! I download Create users in Active Directory from a CSV file with this VBScript from this page and is really helpful for me, my question is how do I add this users to a OU or a group?

Please need your help

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

visit "hey scripting guy"

by CG IT In reply to Help Creating User in AD ...

lots of AD scripts for this.

Collapse -

hey scripting guy

by elmaestro2001 In reply to visit "hey scripting guy"

I know that there are a lot, I have one but the one that I have doesn't let me add the group or the OU where the users will be

Collapse -

Post the script or a link to it

by neilb@uk In reply to Help Creating User in AD ...

and we'll see what's missing. You should certainly be able to place your new user into any preferred OU without any problems.

Collapse -


by CG IT In reply to Post the script or a link ...

if you looked in "Hey Scripting Guy"**4e-86cc-4b2b-8b7d-6a82ab2b465d

you would have found this script.

VBScriptSet objDomain = GetObject("LDAP://dc=fabrikam,dc=com")
Set objOU = objDomain.Create("organizationalUnit", "ou=Management")

Set objOU = GetObject("LDAP://OU=Management,dc=fabrikam,dc=com")
Set objUser = objOU.Create("User", "cn= AckermanPilar")
objUser.Put "sAMAccountName", "AckermanPila"

Set objOU = GetObject("LDAP://OU=Management,dc=fabrikam,dc=com")
Set objGroup = objOU.Create("Group", "cn=atl-users")
objGroup.Put "sAMAccountName", "atl-users"

objGroup.Add objUser.ADSPath

and that script creates an new OU, the account blah blah... you modify the script

'Step 1 : Move USER account from the specific OU to the other OU

set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objcommand.ActiveConnection = objConnection

which is only part of the script... leave it up to you to complete it.

Related Discussions

Related Forums