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
本文地址:http://com.8s8s.com/it/it41892.htm