The DirectoryEntry class represents a resource in the Active Directory and the DirectorySearcher class is used to query the Active Directory. The System.DirectoryServices namespaces provides two important classes DirectoryEntry and DirectorySearcher to work with the Active Directory. To access these classes add to the references.
#Ldap query tool windows 2003 how to
This subject is out of scope for the present article, I will discuss how to query Active Directory using the ADS OleDB provider in a different article. This approach is mostly useful to add Active Directory as a linked server in SQL Server. Using the Active Directory Services OleDB Provider ( ADsDSOObject ).
Add using ActiveDs statement to the top of your file or use fully qualified class names to access ADSI functions. For this, in the Visual Studio C# project go to "Add References." and select the COM tab and select Active DS Type Library from the list. There are different ways to query the Active Directory Services in a C# program I have also used LDAP in this demo since I thought that it will be useful to know this protocol as it is a platform independent protocol. NET DirectoryService classes I am restricting the demo project to querying some commonly used resources (computers, users and printers) in the domain where the user's machine is, at the same time demonstrating the power of Active Directory services and the ease with which Active Directory objects can be retrieved. Since my aim is to demonstrate the usage of. NET framework to manage resources under Windows Active Directory Services. Microsoft provides ADSI (Active Directory Services Interface) which can interact with many providers including IIS (Internet Information Services), LDAP (Lightweight Directory Access Protocol), WinNT and NDS (Novell Netware Directory Service).