How do I find the name of my Primary Domain Controller, and how do I find out which domain controller I logged into? The answer is in VBScript.

Copy the following code into notepad and save it as a file called "findDC.vbs"

==Begin code==
REM if the clients are W2k or above, the ADSystemInfo object has SiteName and
REM GetAnyDCName. If the offices are each in a defined site, then SiteName would
REM be good. I can't find documentation on GetAnyDCName, but I think it will be
REM the DC that responds first. It will be the DNS name in the form similar to
REM MyServer.MyDomain.com.