'How to tell if a remote computer is a domain controller?

I'm looking for a Windows API or a function that I can run against a remote computer to tell if it's a domain controller or not.

I was thinking of asking the remote computer if it's a time source, but any computer can be one. All the Lsa* examples I found are if you're code is actually running on a domain controller or not.

I don't have any code because I'm not sure where to start, and I searched but didn't find anything on stack overflow.

Thanks for any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source