Question Locked

Help Creating User in AD using script

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

5 replies

by elmaestro2001

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

by Member 25348569

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

by cg it

if you looked in "Hey Scripting Guy"

http://gallery.technet.microsoft.com/ScriptCenter/en-us/b9c5914e-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")
objOU.SetInfo

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

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

objGroup.Add objUser.ADSPath

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

http://gallery.technet.microsoft.com/ScriptCenter/en-us/d0498d58-a38c-4d18-9e7c-7868e4d0a7b9

'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.

This discussion is closed to new replies.