Q. How can I return the list of sites that a DC (Domain Controller) covers?

Using Nltest.exe from the Support Tools, I have scripted DCSites.bat to return the list of sites that a DC covers.

The syntax for using DCSites.bat is:

for /f "Tokens=*" %%s in ('DCSites \[dns host name\]') do (
 call :DoSomeThing "%%s"
)
Where \[dns host name\] is optional and used for querying the site coverage of a remote DC.

DCSites.bat contains:

@echo off
setlocal
if \{%1\}==\{\} goto lcl
for /f "Tokens=*" %%s in ('nltest /Server:%1 /dsgetsitecov^|find /I /V "The command completed successfully"') do (
 @echo %%s
)
endlocal
goto :EOF
:lcl
for /f "Tokens=*" %%s in ('nltest /dsgetsitecov^|find /I /V "The command completed successfully"') do (
 @echo %%s
)
endlocal


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