Which Domain Controller?
You’ve probably noticed that if you run the Active Directory Users and Computers snap-in, you can determine which domain controller the snap-in has connected to simply by examining which domain controller is displayed directly within the snap-in. An example of this is shown below in Figure 1 where you can see that the domain controller chosen in this case is dc1.neilhobson.com.
Figure 1: Active Directory Users and Computers Domain Controller Selection
Knowing which domain controller has been selected can be useful when determining whether objects have replicated between domain controllers successfully or not. Additionally, the Active Directory Users and Computers snap-in gives you the ability to switch between domain controllers easily by right-clicking the Active Directory Users and Computers [servername] text right at the top of the left-hand pane and choosing the Connect to Domain Controller option. This text is the highlighted text shown above in Figure 1. However, how do you determine which domain controller Exchange System Manager has connected to? No obvious domain controller selection is displayed in the same manner as with the Active Directory Users and Computers snap-in. Also, how can you force Exchange System Manager to connect to a different domain controller?
Forcing Domain Controller Selection
Let’s tackle the issue of forcing Exchange System Manager to use a specific domain controller first. To do this you first need to bring up the Microsoft Management Console (MMC) by running mmc.exe. Once the MMC window is up, add the Exchange System Manager snap-in to your MMC console. You can do this by first choosing the File -> Add/Remove Snap-in menu option which brings up the Add/Remove Snap-in window. Here, click the Add button which brings up the Add Standalone Snap-in window that provides a list of available snap-ins that you can choose from. Select the Exchange System snap-in and click the Add button. You should then be presented with the Change Domain Controller window as shown below in Figure 2. Unlike the default Exchange System Manager snap-in, you are now able to choose a specific domain controller that you wish to connect to, or you can choose the Any Writable Domain Controller option.
Figure 2: Selecting a Domain Controller
Once you’ve chosen your domain controller, simply click the Close button in the Add Standalone Snap-in window and then click the OK button back in the Add/Remove Snap-in window. The result is a copy of the Exchange System Manager snap-in that has connected to the domain controller of your choice, providing, of course, that you didn’t select the Any Writable Domain Controller option.
Examining Domain Controller Selection
Well, that wasn’t exactly earth-shattering technology in action but it’s still a useful exercise to undertake if you need to force your domain controller selection. What if you have already run the default Exchange System Manager snap-in found in the Start / Programs / Microsoft Exchange folder? Is it possible to determine which domain controller has been selected now? The answer to that is yes, and here’s one way that I have found to do it. In essence you can determine the process ID of Exchange System Manager and then determine to which domain controller this process ID is talking to. Here’s what you need to do. I should say that, although you may initially feel that there are a lot of steps to perform below, you’ll be able to perform them very quickly once you have an understanding of what is required.
First, you need to make sure that the default Exchange System Manager snap-in is running. At this point, it’s important to ensure that this is the only MMC snap-in running at this time. In other words, if you are running any other incidences of MMC such as the Active Directory Users and Computers snap-in, close them down now.
With Exchange System Manager running, you now need to determine its process ID. This can be achieved via the command-line or by using Task Manager. Let’s cover both methods starting with Task Manager first. Bring up the Task Manager by running taskmgr.exe and switch to the Processes tab to show a list of processes running on the server. Don’t forget to check the Show processes from all users check box. It’s the process ID of each running process that we’re interested in but note that, by default, Task Manager does not show the process ID so you’ll need to add the column by choosing View -> Select Columns. In the resulting Select Columns window, click the PID (Process Identifier) option as shown below in Figure 3 and then click OK.
Figure 3: Selecting The Process ID in Task Manager
You should now be back at the main Task Manager window but with the PID (process ID) column now displayed as well. By clicking the Image Name column once, it is possible to arrange the running processes in alphabetical order making the search for the required process much easier. However, which process are you looking for? Since the Exchange System Manager is an MMC snap-in, it runs under the mmc.exe process and for each MMC snap-in running, there should be a corresponding mmc.exe process. Therefore, with multiple MMC snap-ins open there will be multiple instances of mmc.exe shown in Task Manager, thereby making it difficult to determine which one is running the Exchange System Manager. This is why you should only have the one MMC snap-in running at this time, namely Exchange System Manager. The result should be a single instance of mmc.exe running within Task Manager and the process ID displayed. As you can see from Figure 4 below, the required process ID in this case is 5456.
Figure 4: MMC.EXE Process Identification via Task Manager
You can achieve the same result using the tasklist.exe command-line method. In a command prompt, simply run tasklist.exe and you will be presented with a list of running tasks and their process IDs in the PID column. However, if you have a large number of processes running on the server the list can be quite long. Since you know you are looking for the mmc.exe process, you can pipe the results of tasklist.exe into the findstr command and specify that you are looking for the string “mmc.exe” within the output. The required command is:
tasklist | findstr “mmc.exe”
If you have run this correctly, you should see an output similar to that shown below in Figure 5. Obviously you’d expect to see the same process ID whether you’re running the Task Manager application or tasklist.exe. This can be confirmed in Figure 5 since you can again see a process ID of 5456.
Figure 5: MMC.EXE Process Identification via Tasklist.exe
Now that you have your process ID discovered, you need to perform a few more steps in order to determine which domain controller this process ID is talking to. To do this, you can use the netstat.exe program. Netstat is a program used to identify network services and ports on a server and with a few carefully chosen command-line parameters, it can help you identify the link between the process ID just discovered and your domain controllers. If you want a good resource on the use of the netstat program, simply click Start / Help and Support on your Windows 2003 server which will bring up the Help and Support Center. Under Support Tasks, click the Tools link followed by the Command-line reference A-Z link that you will see on the resulting page. You’ll now be able to locate the netstate.exe utility information from here.
I’ve found the following combination of parameters the best to use with netstat:
- -a, which displays all connections and listening ports. Although the –o switch, covered below, displays all active TCP connections, I still prefer to add the –a switch to be sure.
- -n, which speeds up execution of the application by allowing it to show the addresses and port numbers in numerical form rather than using names.
- -o, which displays the active connections together with their process IDs. You will obviously need this switch to allow you to match your process ID.
This means that your command-line now looks like this:
netstat –a –n –o
Before you execute this command-line, however, note that again you may have many processes listed from the output. This will make the finding of your required process ID more difficult. Therefore, you can again pipe the results of netstat.exe into the findstr command, specifying a search string of your process ID. In my example below, the search string is obviously “5456” which is the process ID I discovered earlier. This will refine the output of the netstat command even further. Additionally, you can tidy up the netstat command-line options by placing them all together. Your final command-line then looks like this:
netstat –ano | findstr “5456”
Executing this command will reveal an output similar to that shown below in Figure 6.
Figure 6: NETSTAT.EXE Output
What does this tell you? Well, you can see from Figure 6 above that the IP address 10.1.1.3 has made a connection to the IP address 10.1.1.4 and additionally you can see the port numbers in use. What you are seeing here is the IP address of the server running Exchange System Manager and the IP address of the domain controller. In my example, I know that the server running the netstat command and Exchange System Manager has the IP address of 10.1.1.3, which means that it has connected to the domain controller with the IP address of 10.1.1.4. In my lab, this is the domain controller called dc2.neilhobson.com.
As I said earlier within this article, it can sometimes be useful to know which domain controller the default Exchange System Manager snap-in is communicating with, or even how to force a custom Exchange System Manager snap-in to connect to a specific domain controller. Within this article I have shown you one way to do this. If you know of any others, I’d be happy to hear from you on the email address shown below.