Recipe 3.1. Determining Which Domain Controllers Exchange Is UsingProblemYou need to know which DCs and GCs your Exchange server is currently configured to use, and whether they have been manually assigned or auto-discovered. SolutionUsing a graphical user interface
Using VBScript' This code queries the list of DSAccess instances and ' reports which DCs DSAccess is using. ' ------ SCRIPT CONFIGURATION ------ strServer = "<ServerFQDN>" ' e.g., xch01.foobar.com; the NetBIOS name works too ' ------ END CONFIGURATION --------- Dim objWMIExch Dim listDCInst Dim objDCInst Dim strDCInfo ' Get the Exchange Namespace WMI object Set objWMIExch = GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_ strServer & "/root/MicrosoftExchangeV2") ' Get the list of Exchange_DSAccessDC instances and iterate through them ' to display their properties Set listDCInst = objWMIExch.InstancesOf("Exchange_DSAccessDC") strDCInfo = "" For each objDCInst in listDCInst strDCInfo = strDCInfo & "DC: " & objDCInst.Name & " (" Select Case objDCInst.Type Case 0 strDCInfo = strDCInfo & "Configuration DC)" Case 1 strDCInfo = strDCInfo & "Domain Controller)" Case 2 strDCInfo = strDCInfo & "Global Catalog)" End Select Select Case objDCInst.ConfigurationType Case 0 strDCInfo = strDCInfo & " is manually configured." Case 1 strDCInfo = strDCInfo & " was auto-discovered." End Select strDCInfo = strDCInfo & VbCrLF Next Wscript.Echo strDCInfo DiscussionThe GUI method is straightforward if you are running at least Exchange 2000 SP2. Frankly, if you are still running SP1 or original Exchange 2000, you have bigger problems to worry about. Still, you can find at least a small bit of the information by looking at the field labeled Domain controller used by services on this server on the General tab of the server properties dialog in ESM. It is normal to see multiple DC instances; at a minimum, you're going to have three: one for the configuration DC, one for the DC role, and one for the GC role. The additional instances are used for redundancy and failover. DSAccess will allow only one configuration DC instance, to minimize update issues caused by replication latency in Active Directory's multi-master architecture. On a machine that is both a DC and Exchange server, you will only see three entries no matter how many other DCs you may have deployed; they will all be the local machine (see Recipe 2.9). This is because when you combine these roles, Exchange makes the optimization decision that you probably only have one DC (as when you're running Small Business Server)a reasonable decision in most cases. Using VBScriptThe VBScript solution uses the Exchange WMI namespace and relies on the Exchange_DSAccess class, which was added in Exchange 2000 SP2. If your server is not at least running at that build, the DSADiag utility is going to be your only option; you can get it from Microsoft's Product Support Services (PSS) organization.
The basic technique we used is to retrieve a collection of Exchange_DSAccessDC objects, since each configured or discovered DC instance will be a separate entry. The Name property is a string with the FQDN of the DC configured for that instance, while the Type and ConfigurationType properties tell you what type of instance this is and whether it was auto-discovered or manually configured. Note that the ConfigurationType property is read-only, while both Name and Type are read/write. If you're creating new instances of Exchange_DSAccessDC, you have to specify a name and type when you create them. Additional properties that weren't included in the solution, but may be of interest to you, include:
See AlsoRecipe 2.8 for more on installing Exchange on a DC, Recipe 3.2 for more on forcing Exchange to use specified DCs, Recipe 3.3 and Recipe 3.4 for more on verifying which DCs and GCs are in use, and Recipe 3.8 for troubleshooting the DSAccess discovery process; the Understanding and Troubleshooting Directory Access Microsoft white paper, Chapter 3 of the Exchange Server 2003 Technical Reference Guide, and MS KB 316300 (Event ID 2080 from MSExchangeDSAccess); MSDN documentation for the Exchange_DSAccessDC class |