I need a script to create 10 users in Windows 2003.
Asked
Active
Viewed 83 times
-1
-
2I'm glad to know that you need a script to create 10 users in Windows 2003 (suggested reading: http://www.catb.org/~esr/faqs/smart-questions.html). – Matteo Italia Nov 09 '10 at 21:53
-
3sudo make me a sandwich. – jball Nov 09 '10 at 21:54
-
1Fortunately we can just post our wants on SO and the code monkeys will hop to. Oh, wait. – cHao Nov 09 '10 at 21:55
1 Answers
2
Will VB script work?
Option Explicit
Dim strUser
Dim objRootLDAP, objContainer, objNewUser
for count =0 to 9
strUser = "stackOUser" + count
Set objRootLDAP = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & _
objRootLDAP.Get("defaultNamingContext"))
' Build the actual User.
Set objNewUser = objContainer.Create("User", "cn=" & strUser)
objNewUser.Put "sAMAccountName", strUser
objNewUser.SetInfo
next
WScript.Quit

dexter
- 7,063
- 9
- 54
- 71