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.") ?。innt://為本機名稱 或 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技術!