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

Jerold Schulman

July 11, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today


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:

MemberServer

NOTE: MemberServer.bat uses the DSQUERY command.

MemberServer.bat contains:

@echo offsetlocalset file="%TEMP%MemberServer.TMP"set qry=dsquery * domainroot -filter "(&(objectCategory=Computer)(objectClass=Computer))" -attr name operatingSystem -Limit 0if 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%endlocal



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like