AFP548

Locate nearest domain controller

I'm trying to locate the nearest domain controller for a script. We have numerous locations that use multiple domain controllers and I've created a logon script that configures users servers, email, etc. on the fly. At the moment I've got a large if/else statement that uses part of the computer name to determine a site code and then enters the domain controller based on that. I'm trying to find a way to automate this process. I'm close with some random dns lookups but can anyone point me in the right direction on the "correct" way to do this? Thanks for any info!
Exit mobile version