Service management in Windows Server 2003 and 2008
Tuesday, May 20, 2008 12:35 PM
Use the service controller command found in Windows Server 2003 and 2008 to set a service to disabled, automatic or manual.
The sc (service controller) command manages Windows services from the command line. This can be integral to any semi-automated failover mechanism, service watchdog or a mass update that requires some configuration to the service.
For Windows Server 2003 and Windows Server 2008 environments, the sc command takes the familiar "net start" to additional levels by allowing a service to be set to disabled, automatic or manual, as well as control functions to the service in the current state.
You might use the sc command if you need to update something on your environment, and you need to stop a monitoring service that every server uses. In this situation, you could stop each monitoring agent on each server and make the service disabled with the following code:
sc SERVER1 stop "AlertManagerService" sc SERVER1 config " AlertManagerService " start= disabled
If you use the sc command in reverse, it can enable and restart the service. With the sc command, you can have one central script execute service configuration tasks on multiple servers remotely when the appropriate permissions are available.
When using the sc command, the service name may not match the name you see in the Windows services MMC snap-in. If you use a BlackBerry Enterprise Server (BES), you may have the BlackBerry MDS service installed on your BES server. This service is an example where the display name does not match that of the service name. With the sc command, you can run the following command:
sc email-bes001 GetDisplayName MdsTomcat
The command will give the display name from the services MMC snap-in; from there, you can relate it to your functional needs. Figure A is the output of running this command.
Figure A

You should not omit the base application of sc for creating Windows services. With its remote connection and implementation capabilities, sc can be a critical tool for pushing out a new version of a service with a series of one-liners in scripts when simple file updates, description changes, or configuration of a service are required to reduce the effort in touching similar systems.
The sc command parameters are consistent across Windows Server 2003, Windows Server 2008, and Windows XP, making mixed platform deployments simplified, with only the ShowSid string available on Windows Server 2008.
While the sc command was delivered in the Windows NT era, it is still valuable in mass deployments today for service management.

» Achieve enhanced server performance with energy-efficient blade technology






There are currently no comments for this post.