欢迎光临
我们一直在努力

Active Directory 对象的控制-.NET教程,组件控件开发

建站超值云服务器,限时71元/月

方法一

ldifde.exe,用于批量导入和导出 active directory 对象。使用 ldifde 可以将新用户记录导入目录,或将特定用户的特定信息导出到一个文本文件中。ldifde 默认采用的是输出模式(从目录中读取信息)。如果添加了 -i 选项,则还可以将更改写入目录(请参阅 microsoft 知识库文章 q237677: using ldifde to import and export directory objects to the active directory,“使用 ldifde 向 active directory 中导入或从中导出目录对象”)。另外,如果只想对特定 ou(组织单位)中的所有用户导出和提取特定的细节,如用户名、职务和登录名,可以运行以下命令:

ldifde -f c:\ldif\exportusers.ldf –s servername -d "ou=yourouname,dc=yourdomainname,dc=com" -p subtree -r "(objectclass=user)" -l "cn,givenname,title,samaccountname"

方法二

使用vbs脚本自己编写一个(如下)

global variables

dim ocontainer

dim outputfile

dim filesystem

set filesystem = wscript.createobject("scripting.filesystemobject")

set outputfile = filesystem.createtextfile("asd.txt", true)  

 '输出内容添加入文件名称为asd.txt文件中

set ocontainer = getobject("winnt://billgates.")    'winnt://为本机名称  或 ldap为域名称

enumerateusers(ocontainer)

outputfile.close

set filesystem = nothing

set ocontainer = nothing

wscript.echo "finished"                  '弹出对话框finish

wscript.quit(0)

sub enumerateusers(ocont)

dim ouser

for each ouser in ocont

select case lcase(ouser.class)

case "group"

if not isempty(ouser.name) then

outputfile.writeline "user: " & ouser.name     '显示组名称或用户名称

end if

if not isempty(ouser.class) then

outputfile.writeline "class: " & ouser.class     '显示组类型或用户类型

end if

if not isempty(ouser.member) then

outputfile.writeline "members: " & ouser.member   '显示组成员

end if

end select

next

end sub

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Active Directory 对象的控制-.NET教程,组件控件开发
分享到: 更多 (0)

相关推荐

  • 暂无文章