Monday, 21 January 2008

SBS - Speed up a reboot - command line services shutdown script

One of the ways to speed up an SBS reboot is to shutdown certain key services before clicking the Restart button on updates or when needing to manually reboot the server.

By downing the Exchange services, SMTP, and IIS beforehand, one will see a marked decrease in the amount of time the SBS box will take to reboot.

There are two versions of the batch file:

  1. Local Console - shuts down IIS
  2. Remote Console - leaves IIS alone so as to not break the RWW connection
Console Batch File

Copy and paste the following into a batch file called something like "ConsoleShutdown.bat" "ConsoleServicesOff.bat":
net stop mspop3connector
net stop msexchangeis
net stop msexchangemgmt
net stop resvc
net stop msexchangesa
net stop smtpsvc
net stop w3svc
Note that the first service for the POP3Connector does not need to be there if the feature is not being used. This applies for both versions of the batch file.

The order for shutting down the services is particularly important. Shut down a service that has a dependency first, and an error will be generated for each of the service's dependents.

Remote Batch File

Copy and paste the following into a batch file called something like "RemoteShutdown.bat" "RemoteServicesOff.bat":
net stop mspop3connector
net stop msexchangeis
net stop msexchangemgmt
net stop resvc
net stop msexchangesa
net stop smtpsvc
Note the absence of the last command to shutdown the IIS (W3SVC ) service!

It may not be a good idea to combine the scheduled reboot batch file (previous blog post) and these batch file commands just in case one of the services hangs while stopping.

Best schedule this batch file about 5 minutes before the reboot batch file depending on the speed of the SBS box. Give more time between the two batch files the older the SBS box is.

If something hangs in the first batch file, the -f Force option in the subsequent shutdown command will take care of it.

If you can suggest any further services to shutdown that will not adversely affect things before actually rebooting the server, please do feel free to add a comment with the net stop command! :)

We find the name of the service to be used in the net stop command by looking at the service's properties:

MSExchangeIS = Exchange Information Store Service

In the above example, our command would be: net stop msexchangeis [Enter]

Note that the commands in the batch file are not case sensitive. To start the services from the command line is just as simple: net start msexchangeis [Enter].

UPDATE 2008-02-15: Changed the name of the suggested batch files to better reflect what the batch will do. P.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.

No comments: