Exchange 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 a graphical user interface
- Open the Exchange System Manager (ESM) snap-in.
- In the left pane, browse to the Servers container.
- Right-click on the target server and select Properties.
- Click on the Directory Access tab and view the domain controllers being used.
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.