Recipe 17.26. Listing Domain Controllers and Global Catalog Servers Used by an Exchange ServerProblemYou want to list the domain controllers and global catalog servers currently being used by an Exchange Server. SolutionUsing a graphical user interface
Using VBScript' This code enumerates domain controllers being used. ' ------ SCRIPT CONFIGURATION ------ strComputer = "<Exchange Server>" 'e.g., ExchServer2 ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & _ "\root\MicrosoftExchangeV2") set objDCList = objWMI.ExecQuery("Select * from Exchange_DSAccessDC",,48) for each objDc in objDCList Wscript.Echo "DCName: objDc.name" strTemp = "Automatic" if (dc.ConfigurationType=0) then strTemp="Manual" Wscript.Echo " Selection: " & strTemp Wscript.Echo " Is Fast : " & objDc.IsFast Wscript.Echo " In Sync : " & objDc.IsInSync Wscript.Echo " Is Up : " & objDc.IsUp Wscript.Echo " Ldap Port: " & objDc.LDAPPort strTemp = "Global Catalog" if (objDc.type=0) then strTemp = "Config" if (objDc.type=1) then strTemp = "Local Domain" Wscript.Echo " Role : " & strTemp Wscript.Echo "-----------" Next Wscript.Echo "Script completed successfully." DiscussionExchange is very dependent upon Active Directory domain controllers. The list of domain controllers currently being used by a server is usually one of the first pieces of information you should gather when you encounter an Exchange issue. While this can be done through the GUI, it is much easier to get the data through a script.
While the GUI provides only a listing of the domain controllers and global catalog servers in use, the WMI provider offers considerably more information. This additional information can be extremely important during troubleshooting, so you should have this script or something similar available to your Exchange Admins for troubleshooting purposes. Using VBScript
See AlsoExchange Server 2003 SDK: WMI Reference |