Recipe 4.2. Starting and Stopping ExchangeProblemYou want to manually start or stop the Exchange services without rebooting the computer that hosts them. SolutionUsing a graphical user interfaceTo stop, start, pause, or restart an individual virtual server, do the following:
To stop, start, pause, or restart a service, do the following:
Using a command-line interfaceTo stop the Exchange services locally, log on to the Exchange server with an account that has administrative privileges, and run the following command: > net stop <serviceName> If you want to stop services on a remote machine, you can use the sc ("service control") command with the stop switch: > sc <computerName> stop <serviceName> A complete script to stop all of the Exchange and IIS services would look like this (the /Y switch forces the service control manager to stop the service and any dependent services that have not yet stopped): net stop MSExchangeES net stop IMAP4Svc net stop POP3Svc net stop RESvc net stop MSExchangeSRS net stop MSExchangeMGMT net stop MSExchangeMTA net stop MSExchangeIS /Y net stop MSExchangeSA /Y net stop SMTPSvc net stop W3Svc net stop IISAdmin /Y However, you can cheat by just stopping the Exchange system attendant (net stop msexchangesa /y); since the information store depends on it, that will cleanly shut down the IS and dismount your databases. The other services, like the routing engine and SMTP service, won't be affected by this. DiscussionStarting and stopping the Exchange services is not often necessary. Generally, you only need to stop the services if you're performing some kind of maintenance, like an offline defragmentation (described in Recipe Recipe 6.16). In a few cases, you'll have to stop and restart one service or another (usually either MSExchangeIS or W3SVC) to force it to take notice of some parameter you've changed in Active Directory or the registry. For example, you have to stop and restart the routing engine service to get it to reload its link state table from another server in its routing group. Another, more significant, case where you might need to manually stop the Exchange services is when you're running Exchange Server 2003 on a domain controller that is also a global catalog server. In this case, the AD services can shut down before the Exchange DSAccess component, in which case the DSAccess shutdown will wait, for up to 10 minutes, before giving up and shutting down. To avoid this wait, you can shut down the Exchange services before shutting down the server itself. Table 4-1 lists the Exchange services; along with the common service name, it lists the short names of the services. You can use either format to start or stop services via the command line. It also lists the dependent services for each service. The fastest way to cleanly shut down an Exchange server is to stop the MSExchangeSA service; before the system attendant stops, it will shut down the information store (which in turn forces the IS to flush its transaction logs to disk, dismount all mounted databases, and write the special database header pages that indicate that the databases were cleanly dismounted). See AlsoRecipe 2.8 for running Exchange on a domain controller or global catalog server; MS KB 246287 (How to Write a Batch File to Shut Down Exchange Server Quickly), and MS KB 829361 (Exchange Server 2003 Computer Takes Longer Than You Expect to Shut Down); Chapter 2 of the Exchange Server 2003 Technical Reference Guide for more on the Exchange services and their dependencies |