Active Directory 对象的控制
2024-07-21 02:24:14
供稿:网友
 
方法一
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
网站运营seo文章大全提供全面的站长运营经验及seo技术!