Using the RepAdmin.exe Windows Server 2003 Support Tool, I have scripted 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 a Y or N.

NOTE: see Another way to test if a domain controller is a Global Catalog server?

ISGC.bat contains:

@echo off
if \{%2\}==\{\} @echo Syntax: ISGC ServerName GCVar&exit /b 1
set %2=N
for /f "Tokens=* %%g in ('repadmin /showreps %1 ^|findstr /l /i /C:"DC Options: IS_GC"') do (
 set %2=Y
)
exit /b 0