复制代码 代码如下:
set adsou=getobject("ldap://cn=users,dc=hzcncter,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 "@hzcncter.local"
adsuser.setinfo
adsuser.setpassword strpass
adsuser.accountdisabled=false
adsuser.setinfo
loop
注意保存后,更改一下dc名称(红色字体),如果ou名称是英文,也可以连ou名称一起更改,这样就可以直接将用户建立到ou里面。