JSI Tip 7990. Another way to test if a domain controller is a Global Catalog server?
Jerold Schulman
April 29, 2004
1 Min Read
In tip 7670, I used RepAdmin.exe to script ISGC.bat.
Using DSQUERY, an Active Directory command-line tool, I have scripted another version of ISGC.bat to test if a server is a Global Catalog server.
The syntax for using ISGC.bat is:
call ISGC ServerName GCVar
Where ServerName is the NetBIOS name of the domain controller, and GCVar is a call directed environment variable that will be set to:
X if the server is not found, or is not a domain controller.
Y if the domain controller is a Global Catalog server.
N if the domain controller is NOT a Global Catalog server.
ISGC.bat contains:
@echo offif {%2}=={} @echo Syntax: ISGC ServerName GCVar&exit /b 1:: Initialize GCVar to X (NOT Found or NOT a DC).set %2=Xfor /f "Tokens=*" %%s in ('dsquery server -domain "%USERDNSDOMAIN%" -name %1') do (:: Server is found. set %2=N for /f "Tokens=*" %%g in ('dsquery server -domain "%USERDNSDOMAIN%" -name %1 -isgc') do (:: Server is a Global Catalog Server. set %2=Y ))
About the Author
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