Windows Tools

LDP UI

Overview | Notes | UI | Examples | Related Tools Open Command Prompt

Example 1: Add a New Object to an LDAP Directory

The following example uses LDP to add a user to Active Directory.

  1. Click the Browse menu and select Add.
  2. In the Add dialog box, enter the distinguished name of the new object in the Dn input box.
  3. In the Edit Entry section, add the new attributes and values. Click Enter after typing in each attribute and associated value:
  4. Attribute Value
    userAccountControl 512
    ObjectClass User
    SamAccountName Testuser2
  5. Click Edit to add the attribute or value combination to the Entry List box.
  6. Once all the attributes are entered, click Run to add the information to Active Directory using LDAP APIs.

Example 2: Search an LDAP Directory

The following example performs several searches on Active Directory.

  1. Click the Browse menu and select Search.

    The Search dialog box opens.

  2. In this search, the LDAP directory is Active Directory, and for usernames it contains a givenName attribute for first names, and an attribute of sn for last names. To search for all users that have a first name of John and a last name of either Smith or Jones, use the following filter:

    (&(objectClass=user)(givenName=John)(|(sn=Smith)(sn=Jones))))

  3. To search for users that have a lastname of Jones, but filter out those users that have a first name of John or Jane, and also filter out users that have not logged on at least 100 times. The exclamation point (!) is the NOT operator.

    (&(objectClass=user)(sn=Jones)(!givenName=John)(!givenName=Jane)(!logonCount<=100))

  4. Note

    • To search for reserved characters as part of an attribute value, you must precede the reserved character with an escape character. Use the following escape characters to represent the associated characters:
    Character Escape characters
    * 2a
    ( 28
    ) 29
    \ 5c
    NUL 00
  5. To search for all of the users whose display names end in a close parenthesis character, use the following search:

    (&(objectClass=user)(displayName=*\29))

  6. Queries support asterisk wildcards (*). To search for all users who have a surname that starts with the letter J:

    (&(objectClass=user)(sn=j*))

  7. The following search is for users whose home directories are G:\Accounting. The attribute name is home-directories:

    (&(objectClass=user)(home-directory=G:\5cACCOUNTING*))

Example 3: Control the Returns on a Search of an LDAP Directory

The following example uses the Search Options dialog box to control which attributes are displayed in a search. Just a few attributes are displayed, and the rest are filtered so that they are not displayed in the details window of LDP.

  1. In the Attributes input box, enter the attributes to display. Enter the following:
    "memberof;range:1-20"objectClass;objectGUID

    A range is specified for the memberof attribute. A semicolon is also used to do this so that the entire section must be separated from the rest of the attributes by quotes.

  2. Note

    • Separate attributes with a semicolon. No spaces are necessary. All other attributes will be filtered out of the display.
  3. All searches will display only the memberof, objectClass, and objectGUID attributes in the details pane.
  4. Note

    • To return all attributes, replace any existing list of attributes with the asterisk wildcard character (*).

Example 4: Viewing Replication Metadata for an Object

The following example uses LDP to list the replication metadata for an object in Active Directory.

  1. Click the Browse menu and select Replication|View Metadata.

    The View Metadata dialog box opens.

  2. Enter the distinguished name of the object in the Object Dn input box.
  3. Click OK
AttID Ver Loc.USN Originating DSA Org.USN Org.Time/Date
0 1 3693 9fad4c38-2d76-44b2-84f6-f2fe384f8450 3693 2000-12-29 09:15.02
3 1 3693 9fad4c38-2d76-44b2-84f6-f2fe384f8450 3693 2000-12-29 09:15.02
d 1 3693 9fad4c38-2d76-44b2-84f6-f2fe384f8450 3693 2000-12-29 09:15.02
20001 1 3693 9fad4c38-2d76-44b2-84f6-f2fe384f8450 3693 2000-12-29 09:15.02
20002 1 3693 9fad4c38-2d76-44b2-84f6-f2fe384f8450 3693 2000-12-29 09:15.02