Control of Active Directory objects

Source: Internet
Author: User
Tags knowledge base
Active| Object | Control method A
LDIFDE.exe, for bulk import and export of Active Directory objects. You can use LDIFDE to import new user records into a directory, or to export specific information for a specific user to a text file. The LDIFDE default is the output mode (read information from the directory). If you add the-i option, you can also write changes to the directory (see Microsoft Knowledge Base article q237677:using LDIFDE to Import and Export Directory Objects to the Active Dir Ectory, "Import or export directory objects from Active directory using LDIFDE"). Also, if you want to export and extract specific details, such as user names, titles, and logins, for all users in a specific OU (organizational unit), you can run the following command:
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 "


Method Two
Write one yourself using the VBS script (as follows)
' Global variables
Dim Ocontainer
Dim outputfile
Dim filesystem

Set filesystem = WScript.CreateObject ("Scripting.FileSystemObject")
Set outputfile = Filesystem.createtextfile ("Asd.txt", True)
' output added to filename called Asd.txt file

Set Ocontainer = GetObject ("winnt://billgates.") ' winnt://for local name or LDAP for domain name

Enumerateusers (Ocontainer)


Outputfile.close
Set filesystem = Nothing
Set Ocontainer = Nothing

WScript.Echo "Finished" pop-up dialog 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 ' displays group name or user name
End If
If not IsEmpty (ouser.class) Then
Outputfile.writeline "Class:" & Ouser.class ' display group type or user type
End If
If not IsEmpty (ouser.member) Then
Outputfile.writeline "Members:" & Ouser.member ' Display group member
End If
End Select

Next
End Sub




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.