![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | create account PLease help. i have created a script to create an account by manuely inserting the OU Location strUser = newuser. strOuList = OU=*************,DC=***********,DC=***********,DC=COM i having trouble manuely inserting the strUser and strOuList and manuelly inserting the strmember(similar user),& strOuList2. i would like the script to copy membership from strmember to strUser If strmember = "" Then MsgBox "You're missing required fields",64, "Alert" Exit Sub End If strOuList2 = TextBox10.Value If strOuList2 = "" Then MsgBox "You're missing required fields.",64, "Alert" Exit Sub End If ====================================================================== Set objUser1 = GetObject("LDAP://CN=" & strmember "," & strOuList2) Set objUser2 = GetObject("LDAP://CN=" & strUser "," & strOuList) For Each objGroup In objUser1.Groups If (objGroup.IsMember(objUser1.AdsPath) = False) Then objGroup.Add(objUser2.AdsPath) END IF Next |
My System Specs![]() |
| | #2 (permalink) |
| | Re: create account deen wrote: Quote: > PLease help. > i have created a script to create an account by manuely inserting the > OU Location > > strUser = newuser. > strOuList = OU=*************,DC=***********,DC=***********,DC=COM > > i having trouble manuely inserting the strUser and strOuList and > manuelly inserting the strmember(similar user),& strOuList2. > > i would like the script to copy membership from strmember to strUser > > If strmember = "" Then > MsgBox "You're missing required fields",64, "Alert" > Exit Sub > End If > > strOuList2 = TextBox10.Value > If strOuList2 = "" Then > MsgBox "You're missing required fields.",64, "Alert" > Exit Sub > End If > > ====================================================================== > > Set objUser1 = GetObject("LDAP://CN=" & strmember "," & strOuList2) > Set objUser2 = GetObject("LDAP://CN=" & strUser "," & strOuList) > > For Each objGroup In objUser1.Groups > If (objGroup.IsMember(objUser1.AdsPath) = False) Then > objGroup.Add(objUser2.AdsPath) > END IF > Next > script every time you use it, or you can pass parameters to the script, or you can have the script prompt for values. If you pass parameters to the program on the command line use the Wscript.Arguments collection to access them in your program. For example, if the VBScript program is called CreateUser.vbs, you can pass strUser, strMember, strOUList, and strOUList2 as parameters with a command line similar to: cscript CreateUser.vbs JimSmith, MaryWilson, "ou=West,dc=MyDomain,dc=com", "ou=East,dc=MyDomain,dc=com" Then in the script use Wscript.Arguments to access the parameters. For example: ======== If (Wscript.Arguments.Count <> 4) Then Wscript.Echo "Arguments missing" Wscript.Quit End If strUser = Wscript.Arguments(0) strMember = Wscript.Arguments(1) strOUList = Wscript.Arguments(2) strOUList1 = Wscript.Arguments(3) ======= The arguments must be provided in the correct order. Or, it might make more sense to have the program prompt for values, using the InputBox function. For example: ========= strUser = InputBox("Enter Common Name of new user", "Create User") strOUList = InputBox("Enter DN OU where new user will be created", "Create User") strMember = InputBox("Enter Common Name of template user to copy group memberships", "Create User") strOUList2 = InputBox("Enter DN of OU of template user", "Create User") -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: create account "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:%23sd0NGJ$IHA.4616@xxxxxx Quote: > deen wrote: > Quote: >> PLease help. >> i have created a script to create an account by manuely inserting the >> OU Location >> >> strUser = newuser. >> strOuList = OU=*************,DC=***********,DC=***********,DC=COM >> >> i having trouble manuely inserting the strUser and strOuList and >> manuelly inserting the strmember(similar user),& strOuList2. >> >> i would like the script to copy membership from strmember to strUser >> >> If strmember = "" Then >> MsgBox "You're missing required fields",64, "Alert" >> Exit Sub >> End If >> >> strOuList2 = TextBox10.Value >> If strOuList2 = "" Then >> MsgBox "You're missing required fields.",64, "Alert" >> Exit Sub >> End If >> >> ====================================================================== >> >> Set objUser1 = GetObject("LDAP://CN=" & strmember "," & strOuList2) >> Set objUser2 = GetObject("LDAP://CN=" & strUser "," & strOuList) >> >> For Each objGroup In objUser1.Groups >> If (objGroup.IsMember(objUser1.AdsPath) = False) Then >> objGroup.Add(objUser2.AdsPath) >> END IF >> Next >> > You can hard code values in the script, in which case you must edit the > script every time you use it, or you can pass parameters to the script, or > you can have the script prompt for values. If you pass parameters to the > program on the command line use the Wscript.Arguments collection to access > them in your program. For example, if the VBScript program is called > CreateUser.vbs, you can pass strUser, strMember, strOUList, and strOUList2 > as parameters with a command line similar to: > > cscript CreateUser.vbs JimSmith, MaryWilson, "ou=West,dc=MyDomain,dc=com", > "ou=East,dc=MyDomain,dc=com" > > Then in the script use Wscript.Arguments to access the parameters. For > example: > ======== > If (Wscript.Arguments.Count <> 4) Then > Wscript.Echo "Arguments missing" > Wscript.Quit > End If > > strUser = Wscript.Arguments(0) > strMember = Wscript.Arguments(1) > strOUList = Wscript.Arguments(2) > strOUList1 = Wscript.Arguments(3) > ======= > The arguments must be provided in the correct order. Or, it might make > more sense to have the program prompt for values, using the InputBox > function. For example: > ========= > strUser = InputBox("Enter Common Name of new user", "Create User") > strOUList = InputBox("Enter DN OU where new user will be created", "Create > User") > strMember = InputBox("Enter Common Name of template user to copy group > memberships", "Create User") > strOUList2 = InputBox("Enter DN of OU of template user", "Create User") the account to be created and the template account to use, why not ask for: - CN of account to be created - sAMAccountName of template account - sAMAccountName of an account in the OU where the new account is to be created if different from the template account and then determine the DN's of the account(s) and their OU's by applying NAMETRANSLATE to the sAMAccountNames, and the "parent" attribute of the account in the target OU? I'd provide an example, but all my code is at work and my recollection of the details is woefully poorer than Richard's ;-) /Al Quote: |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: Copy a user account & create duplicate account w/new name? | Vista General | |||
| Cannot Create Fax Account | General Discussion | |||
| you have to create a fax-account | Vista print fax & scan | |||
| Help me create my account | Vista mail | |||
| Cannot create new account. Help! | Vista General | |||