开发者

Creating users in Windows 2003 [closed]

开发者 https://www.devze.com 2023-01-24 11:32 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 y开发者_运维百科ears ago.

I need a script to create 10 users in Windows 2003.


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 
0

精彩评论

暂无评论...
验证码 换一张
取 消