JSI Tip 8242. How do I return a list of member servers without using 'NETDOM QUERY SERVER'?

When I run NETDOM QUERY SERVER, it does not return any servers, probably due to a bug in the version of NETDOM that I am using.

I have scripted MemberServer.bat to return a list of member servers in my domain.

The syntax for using MemberServer.bat is:


NOTE: MemberServer.bat uses the DSQUERY command.

MemberServer.bat contains:

@echo off
set file="%TEMP%\MemberServer.TMP"
set qry=dsquery * domainroot -filter "(&(objectCategory=Computer)(objectClass=Computer))" -attr name operatingSystem -Limit 0
if exist %file% del /q %file%
dsquery server -o rdn>>%file%
for /f "Tokens=1*" %%a in ('%qry%^|findstr /L /I /C:"Server"^|findstr /I /V /L /G:%file%') do (
 @echo %%a
del /q %file%

Hide 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.