I've been using the following code to bind to active directory and perform queries:
string s_szAdServerName = new DirectoryEntry("LDAP://rootDSE").Properties["dnsHostName"].Value.ToString();
However, this fails when I'm running as the local machine administrator. If I hard-code the name of the server, the local admin account is able to perform lookups in active directory, so surely there must be a way to lookup the active directory server in
the first place.
Obviously this does work if I'm logged on as a domain user, but my application needs to be able to figure this out from a local admin account, when no domain users are known.
zeroid
0 Points
4 Posts
How do I lookup the active directory server when logged in as a local admin?
Nov 28, 2008 10:21 AM|LINK
I've been using the following code to bind to active directory and perform queries:
string s_szAdServerName = new DirectoryEntry("LDAP://rootDSE").Properties["dnsHostName"].Value.ToString();
However, this fails when I'm running as the local machine administrator. If I hard-code the name of the server, the local admin account is able to perform lookups in active directory, so surely there must be a way to lookup the active directory server in the first place.
Obviously this does work if I'm logged on as a domain user, but my application needs to be able to figure this out from a local admin account, when no domain users are known.
LDAP