How do I find out which computer is the domain controller in Windows programmatically? January 3, 2023 by Tarik With the most simple programming language: DOS batch echo %LOGONSERVER%