Babcy
asked on
How to enumerate all the users in Active Directory
Can any one tell me the command in windows to enumerate all the users in domain?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
using (var context = new PrincipalContext(ContextTy
{
using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
{
foreach (var result in searcher.FindAll())
{
DirectoryEntry de = result.GetUnderlyingObject
Console.WriteLine("First Name: " + de.Properties["givenName"]
Console.WriteLine("Last Name : " + de.Properties["sn"].Value)
Console.WriteLine("SAM account name : " + de.Properties["samAccountN
Console.WriteLine("User principal name: " + de.Properties["userPrincip
Console.WriteLine();
}
}
}
Console.ReadLine();