Skip to content

Instantly share code, notes, and snippets.

@mlhaufe
Created July 17, 2014 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mlhaufe/e8ba923bb4482efbb2dd to your computer and use it in GitHub Desktop.
Save mlhaufe/e8ba923bb4482efbb2dd to your computer and use it in GitHub Desktop.
Active Directory from LINQPad
var searchRoot = new System.DirectoryServices.DirectoryEntry(
@"LDAP://server:389/DC=foo,DC=com",
@"DOMAIN\USERNAME",
"PASSWORD"
){ AuthenticationType = AuthenticationTypes.ReadonlyServer };
using(var searcher = new System.DirectoryServices.DirectorySearcher(searchRoot)) {
searcher.Filter = "(&(objectCategory=group))";
var results = searcher.FindAll();
results.Dump();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment