简体   繁体   中英

Account to query the active directory

is there any way to query an active directory without having the current computer being on the active directory ?

Our client would like to get infos from an AD, but requires the client computer don't be part of this AD. Maybe there's a config or a custom user we can pass in our source code written in C#. I join a screenshot of some source code to show you how we query the AD now : http://d.pr/i/zyAv

Sorry for the bad english, and thanks a lot for your help!

You can explore an external active directory domain just providing a valid user of that domain to query the domain server to the DirectoryEntry object.

string adUser = "DomainUser";
string adPass = "DomainUserPassword";
string path = "LDAP://x.x.x.x"; // Here goes your Domain Server IP.
DirectoryEntry rootEntry = new DirectoryEntry(path, adUser, adPass);
DirectorySearcher ds = new DirectorySearcher(rootEntry );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM