Created
July 17, 2014 19:04
-
-
Save mlhaufe/e8ba923bb4482efbb2dd to your computer and use it in GitHub Desktop.
Active Directory from LINQPad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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