I use this code to query Active Directory, with the AD server name hardcoded:
Recently, my Active Directory server went off-line and I have to change the code of the query to point another AD Server in the forest, my question is:
Is there any way to dinamically query the most-available AD server for querys instead of coding the server name..?
If you can drop out to a command prompt or query the registry you can find a value from the system environment variable LOGONSERVER. This usually requires a logged on user to populate though.An alternative is to PING the domain name for an IP.
answered May 07, 2012 at 12:33 PM