using System;
using System.DirectoryServices;
namespace ActiveDirectory
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
static void Main (string[] args)
{
//Note : microsoft is the name of my domain for testing purposes.
DirectoryEntry entry = new DirectoryEntry("LDAP://microsoft");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=*)");
Console.WriteLine("Active Directory Information");
Console.WriteLine("===========================================");
foreach(System.DirectoryServices.SearchResult resEnt
in mySearcher.FindAll())
{
Console.WriteLine( resEnt.GetDirectoryEntry().Name.ToString() );
Console.WriteLine( resEnt.GetDirectoryEntry().Path.ToString() );
Console.WriteLine( resEnt.GetDirectoryEntry().NativeGuid.ToString() );
Console.WriteLine("===========================================");
}
}
}
}