# Google Analytics

Test LDAP queries

You want to import users and groups from Active Directory and want to develop and test your own LDAP query.

Rudimentary Windows search tool

If your main interest is in testing a query, this is a good tool which is included in the Windows operating system.

  1. From a windows command line or run dialog.
  2. Run %SystemRoot%\SYSTEM32\rundll32.exe dsquery,OpenQueryWindow
  3. In the Find drop down select Custom Search.
  4. Then switch to the Advanced tab.
  5. Here you can test your query
  6. See https://technet.microsoft.com/en-us/library/cc961564.aspx for more information.

Microsoft Sysinternals - Active Directory Explorer

If you are starting to write your first queries this tool may help you to explore your AD structure and the required syntax of queries. It may help you while learning how to write LDAP queries.

  1. At https://technet.microsoft.com/en-us/sysinternals/adexplorer download AdExplorer.exe and run it, there is no installation required.
  2. Connect to your active directory with the same credentials you want to use in the iGrafx Platform to import from the Active Directory.
  3. Click down the AD tree until you reach a point in the directory you think is the right place to start a query, your Search base in the iGrafx Plaform administration.
  4. Right click that folder and select Search Container.
  5. Note while building the query you can click through the tree to find the right object addresses.
  6. Build your query, or better parts of the query you later concatenate via an OR statement as the search container dialog treats all constraints as an AND concatenation. See the following example on how to combine search constraints. 
    Please note the bracket color coding for statement, AND, OR.
    (&(objectCategory=Person)(sAMAccountName=*)(|(memberOf=CN=IGXUS Preview Users,OU=IGXUS,OU=External,OU=Colo Users,DC=ad,DC=igrafxdemo,DC=com)(memberOf=CN=iGrafx Preview Administrators,OU=External,OU=Colo Users,DC=ad,DC=igrafxdemo,DC=com)))

    The query window displays the full query in the middle or only a part of the statement depending on your selection.

How to find more resources

You need more reading and additional information on how to write LDAP queries?

http://lmgtfy.com/?q=write+ldap+query