leederbyshire.com  Mobile web applications for Microsoft Exchange Server.

Shutdown Exchange 2007

Speed Up A Slow Microsoft Exchange 2007 Domain Controller Reboot

Back to Articles page

The official advice is that you should not install Exchange on a Domain Controller, but we've all done it. It usually comes down to cost, and how many users you are supporting. Those of you that do have Exchange running on a DC will have noticed that a reboot is very slow. It can take somewhere between 15 and 30 minutes to shut down or reboot. I used to think that it was just me, but it turns out that they all do that. Luckily, there is something you can do about it.

The problem is caused by the fact that Windows shuts down Active Directory before it shuts down the Exchange services. By the time Exchange shuts down, it is still trying to communicate with the inactive AD services. And it is prepared to wait a long time for a response, even though it never comes. This wouldn't be a problem if you never needed to reboot, yet many automatic updates seem to insist on it.

All you need to do is to remember to shut down Exchange before you reboot. You can do this using the Services utility, but the hard part is remembering to do it. The method described here will ensure that each time you reboot or restart, the Exchange services will automatically be stopped before any others.

This method relies on using the Group Policy Editor to configure the server to execute a batch file at shutdown time. First, we need to create the batch file that will shut down the Exchange services. The batch file is very short, and you can create it in Notepad. Here are the contents of the batch file. if you like, you can copy/paste it, rather than type it yourself:

  net stop msexchangeadtopology /y
  net stop msftesql-exchange /y
  net stop msexchangeis /y
  net stop msexchangesa /y
  net stop iisadmin /y
For the rest of the article, I will assume that the file is going to be named ExchShutdown.bat and will be saved in the root of the server's C: drive, but you can also save it in a shared folder if you want it to be used by other servers.

Now, we are going to use the Group Policy Editor to configure the server to execute this batch file every time it is shut down. Click on Run on your server's Start Menu, and type gpedit.msc , then click OK to start the Group Policy Editor. Expand the tree in the left-hand window through Computer Configuration, Windows Settings, and Scripts (Startup/Shutdown). Right-click Shutdown in the right-hand window, and select the Properties open from the context menu as shown in figure 1.

  Fig. 1 - The Group Policy Editor.

You probably do not have any shutdown scripts configured yet, so the list will probably be empty (figure 2):

  Fig. 2 - Shutdown Scripts for the Local Computer.

Click the Add button, and then Browse... to the location of the batch file that you created. Select your batch file, and click Open.

  Fig. 3 - Adding a Shutdown Script.

Once you have the script name field populated with the batch file path as shown in figure 3, click OK to add it to the list of Shutdown Scripts, as shown in figure 4:

  Fig. 4 - The Shutdown Script added to the list.

Click OK to save the changes, close the Group Policy Editor, and the procedure is finished.

Unless you're working very late, this won't be something you can test immediately; but the next time you need to reboot the server, you should find that it happens a lot quicker than it used to. More like three minutes instead of twenty.

Copyright © 2018 Lee Derbyshire. All rights reserved.