Author:水如烟(http://blog.csdn.net/lzmtw)
用的是VBS.我的域名是fkdl.lcoal,添加用户到Users中.
下面是AddUsers.Vbs的内容:它从同文件夹的users.txt读取要添加的用户及其密码.
Set adsOU=GetObject("LDAP://CN=Users,DC=fkdl,DC=local")
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("users.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrUserList = Split(strNextLine , ",")
strUser=arrUserList(0)
strPass=arrUserList(1)
Set adsUser=adsOU.Create("user","CN=" & strUser)
adsUser.Put "samAccountName", strUser
adsUser.Put "userPrincipalName", strUser & "@fkdl.local"
adsUser.SetInfo
adsUser.SetPassword strPass
adsUser.AccountDisabled=False
adsUser.SetInfo
Loop
Users.txt格式:
用户,密码
比如,
Master,74@#455dR44G