LKBEN10662: Howto find all users or objects with a user defined ldap query in active directory


You need to find all users or certain objects with a self defined ldap query




You can use the following ldap query syntax to search for all users. Please not the exclamation mark which negates the objectClass computer. The cn can be anything.


Here we serach for all users where the name starts with a-


This ldap query searches for all computers with srv in the name


Here we search for all users


Here we search for all deactivated accounts in active directory


This query will find all acounts with "password does not expire"


Here we search for all groups containing rw in the name


A bit more complex is the search for all printers starting with hp for the name, standing in the location starting with hh and supporting duplex printing


Search for all Organisational units starting with hh



The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.