显示当前域内所有计算机名称及数目
const ads_scope_subtree = 2
set objrootdse = getobject("ldap://rootdse")
strdomain = objrootdse.get("defaultnamingcontext")
set objconnection = createobject("adodb.connection")
set objcommand = createobject("adodb.command")
objconnection.provider = "adsdsoobject"
objconnection.open "active directory provider"
set objcommand.activeconnection = objconnection
objcommand.properties("page size") = 1000
objcommand.properties("searchscope") = ads_scope_subtree
objcommand.commandtext = "select * from 'ldap://" & strdomain & "' where objectcategory='computer'"
set objrecordset = objcommand.execute
objrecordset.movefirst
do until objrecordset.eof
wscript.echo objrecordset.fields("adspath").value
objrecordset.movenext
loop
wscript.echo ""
wscript.echo "total computer: "&objrecordset.recordcount
显示当前域内所有用户名称及数目
const ads_scope_subtree = 2
set objrootdse = getobject("ldap://rootdse")
strdomain = objrootdse.get("defaultnamingcontext")
set objconnection = createobject("adodb.connection")
set objcommand = createobject("adodb.command")
objconnection.provider = "adsdsoobject"
objconnection.open "active directory provider"
set objcommand.activeconnection = objconnection
objcommand.properties("page size") = 1000
objcommand.properties("searchscope") = ads_scope_subtree
objcommand.commandtext = "select * from 'ldap://" & strdomain & "' where objectcategory='user'"
set objrecordset = objcommand.execute
objrecordset.movefirst
do until objrecordset.eof
wscript.echo objrecordset.fields("adspath").value
objrecordset.movenext
loop
wscript.echo ""
wscript.echo "total user: "&objrecordset.recordcount
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论