Skip navigation

How can I verify whether a domain controller (DC) is in a certain site?

A. The following script, which you can download here, determines whether a DC is in the site in question. You must input the name of the DC and the site whose membership you're checking. If the DC is in the site, the script returns TRUE with an error level of 0; otherwise, it returns FALSE and an error level of 1.

if Wscript.Arguments.Count cscript checkdcinsite.vbs savdaldc01 london
FALSE
D:\Temp>echo %errorlevel%
1
D:\Temp>cscript checkdcinsite.vbs savdaldc01 dallas
TRUE
D:\Temp>echo %errorlevel%
0
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish