Windows 2000 Server Services, Part 1

By Jordan Ayala

Tools and tips for managing fundamental components of the Windows architecture

This article is from the November 2001 issue of Windows & .NET Magazine.

Windows' services are central to the function of the OS and your loaded applications. Your system hosts dozens of services that control just about everything you can do with Windows. They enable actions from logging on to file-and-print functionality to supporting legacy networks. In this first part of a two-part series, I give you a definition of services and what they do as well as tools and tips about how to manage them. I discuss the services available in Windows 2000 Server, Standard Edition without service packs applied (the other Windows 2000 server products and Windows 2000 Professional have different service options). The information I provide here sets the foundation for configuring and performance-tuning your Windows 2000 services, which I'll discuss in Part 2.

On This Page

What Is a Service? Service Administration Taking Action Installing and Uninstalling Services Learn the Basics

What Is a Service?

The Windows NT architecture has always used the services model (i.e., operational modules that encapsulate specific system functions). For example, Windows 2000's Indexing Service contains all the compiled code and interfaces necessary to index content on your server. Other applications and services can rely on and use the Indexing Service to provide even more functionality. A case in point is Microsoft SQL Server 2000's cross-store search function, which uses the Indexing Service to let you search for content across files and directories, on the Web, in SQL Server databases, and even in the Microsoft Exchange Server Web Store.

Isolating functions neatly into individual services makes the functions more manageable and easier to use. In addition, the isolation gives you fine-grained control over execution and availability of the OS or application features, helps you troubleshoot problems, and lets you easily access system information, such as network properties and performance counters.

A service can be a core part of the OS's Service Controller, which is the services.exe file in the \winnt\system32 directory. You can also find running services on the Processes tab in the Task Manager dialog box. A service can also be an application or the compartmentalized functionality of a server application such as SQL Server or Exchange. For example, installing Exchange loads a new selection of services that makes up the application's messaging and collaboration functionality. You can even set an individual end-user or desktop application to run as a system service.

Service Administration

Managing services on your Windows 2000 Server system is fairly straightforward. Log on to your server as Administrator or to an account in the Administrators group that lets you change services' settings. The Microsoft Management Console (MMC) Computer Management snap-in gives you complete control over services' attributes and execution and lets you view services' status. To access the Computer Management snap-in, click Start, Services, Programs, Administrative Tools, or right-click the My Computer icon on your desktop and select Manage. In the Computer Management window, which Figure 1 shows, expand the Services and Applications tree and click Services. The right pane will list all the installed services on your system, regardless of whether they're running.

Bb742520.ssvc101(en-us,TechNet.10).gif

Figure 1: Viewing system services

Right-clicking a service brings up a menu of tasks, which Table 1 defines. You can also use the icon that accompanies each listed service to start, stop, pause, or restart the service. Just select the service and click the appropriate icon.

Table 1 Services' Task Menu Selections

Task

Action

All Tasks

A submenu of the Pause, Restart, Resume, Start, and Stop tasks.

Help

Provides helpful information about the selected service.

Pause

Pauses a running service.

Properties

Brings up the Properties dialog box for the selected service.

Refresh

Refreshes the Services display pane.

Restart

Stops and restarts a service and any dependent services in one action.

Resume

Returns a paused service to its typical operational state.

Start

Starts a service that you stopped or that failed to start automatically at boot.

Stop

Stops a running service. (Stopping a service also stops a running application that depends on the stopped service, which can cause a crucial application fault. You should be very careful about stopping a service on a production server.)

By default, the Computer Management console displays five columns of information for each currently installed service: Name, Description, Status, Startup Type, and Log On As. However, you can configure the Computer Management console by selecting Choose Columns from the View menu. At the resulting dialog box, you can select the data that you want the console to display.

Bb742520.ssvc102(en-us,TechNet.10).gif

Figure 2: A service's general properties window

To view a service's properties, right-click or double-click the service name and select Properties from the pop-up menu. Figure 2 shows the Properties dialog box for the Fax Service. This dialog box offers far more control than NT 4.0 provides. On the General tab, you can't change the service name, but you can change both the display name and the description, which might help you organize your services in the management interface for easier recognition and use. The General tab also displays the path to the service's executable file. The Fax Service is a standalone executable that the system runs as a service, whereas other system services, such as the Alerter service, are part of the core Windows functionality and the OS's Service Controller. From the Startup type drop-down list on the General tab, you can select whether the system service or application is loaded automatically or manually or is disabled. Table 2 outlines these options. To govern how the Fax Service operates, you can change the Service status parameter to Start, Stop, Pause, or Resume. In the Start parameters text box, you can specify start parameters that you want the system to pass to the service when it loads, such as file locations and control attributes.

Table 2 Services' Startup Parameters

Parameter

Description

Automatic

The service is loaded and runs automatically when the server boots.

Disabled

The service isn't loaded when the server boots; dependent services that need to start and use the disabled service won't be able to do so.

Manual

The service isn't loaded when the server boots; you must manually launch the service from the Services container.

Bb742520.ssvc103(en-us,TechNet.10).gif

Figure 3: A service's logon settings

The Log On tab of the Properties dialog box, which Figure 3 shows, gives you control over a service's security attributes. On this tab, you can select which security attribute the service runs under, determining the scope of its operation in the system as well as that of any application that depends on the service. Thus, use caution when you configure this tab's settings. By default, services log on and run with the security attributes of the LocalSystem account (a unique system user account that's local to the server and doesn't provide logon or network access). LocalSystem is similar to the Administrator account in that LocalSystem runs under the authority of the OS. Therefore, the service has the access necessary to run properly. You can also set a service to run under a user account that you create for a specific purpose, such as centralizing the management of certain applications. (For example, you might create an Exchange_Server user account that only Exchange Server services use and that's associated with specific user rights and policies.) On the Log On tab, you can also associate service-execution parameters with hardware profiles to control which applications and services run under various hardware configurations. For example, you might have a special maintenance-mode profile in which the server boots to a minimum configuration that has all peripheral devices, storage arrays, and the related system services disabled so that you can install or upgrade applications without interference.

The Recovery tab provides new functionality in Windows 2000. If a service fails under NT 4.0, all you can do is look in the event logs for a clue about the cause. You need additional management tools to solve the problem from there. As Figure 4 shows, the Recovery tab provides a drop-down list of actions the system can take after a service's first failure, second failure, and subsequent failures. You can choose from four options: Take no action, Restart the Service, Run a File, or Reboot the Computer. Judiciously selecting actions makes your server self-maintaining to a certain extent. For example, if the Fax Service configured in Figure 4 stops for some reason, the server will first try to restart the service. On the second failure, the server will run a file containing an application that sends a page alert to the systems administrator. If the service fails again, the system will reboot.

Bb742520.ssvc104(en-us,TechNet.10).gif

Figure 4: A service's recovery properties

The Recovery tab also gives you access to an attribute that resets the failure count so that the count doesn't get caught in a terminal loop. In addition, you can set the length of time the server will wait before it tries to restart the service. Clicking Restart Computer Options takes you to a dialog box, which Figure 5 shows, in which you can specify what will happen if an automatic system reboot becomes necessary.

Bb742520.ssvc105(en-us,TechNet.10).gif

Figure 5: Configuring the Restart Computer Options settings

The Dependencies tab shows which services the selected service relies on for its operation and which services depend on the selected service. Figure 6 shows that the Plug and Play and Print Spooler services, among others, are necessary for the Fax Service to function, but that no other applications or services currently depend on the Fax Service.

Bb742520.ssvc106(en-us,TechNet.10).gif

Figure 6: A service's dependencies

Some systems management applications let you remotely control services (e.g., restart a failed application service over a dial-up connection). You can find this useful functionality in many popular systems management tools and out-of-band management applications as well as in the Microsoft Windows 2000 Resource Kit.

You can also manage services from a command prompt. Use the Net Start and Net Stop commands to pass parameters to a service and control its execution. Use the command prompt to create system startup and shutdown scripts that let you simultaneously control many services, or to create batch commands that restart multiple services after an error.

Taking Action

Why would you want to look up or modify a service's settings? Many situations require you to investigate the status of the services on your system and take action, as the following examples show.

An application or service has a problem . If you receive an event-log warning or a system error or if an application isn't functioning properly, you'll need to navigate to the services management tool that I discussed in the previous section.

You need to cause configuration changes to take effect. Changing a service's properties or server network settings sometimes requires you to reboot the system or at least restart a service. You can use the services management tool's tasks to manually stop and restart the required services, causing the changes to take effect without rebooting the system.

You need to troubleshoot. If your server is having difficulties, a useful method of tracking the cause is to shut down services one by one until you discover which service is causing the problem. Or, you can shut down all application services until you can diagnose the one you know to be problematic.

You want to change the way the system behaves. If you want to control access to the server by shutting down network authentication services, change service security settings, or turn applications on and off, you can do so from the services management tool.

You need to shut down services to install applications or system updates. Sometimes you need to use the services management tool to shut down services and install various applications or system updates. For example, you must terminate all services that use ODBC before you can install the Microsoft Data Access Components (MDAC) update.

You need to install new services or applications. Before installation, some applications, services, and system updates require you to stop a server application. For example, before you can apply an MDAC update, you must shut down all ODBC-dependent services.

Installing and Uninstalling Services

If you installed and then removed applications from pre-Windows 2000 Windows installations, the uninstallation process invariably left little program gremlins on your system. In Windows 2000, Microsoft has significantly improved this situation by designing the OS to maintain much tighter control over application components and their code. The result is that you can use Windows 2000's native packaging and development tools to minimize the instances of nonfunctional services remaining in your configuration.

In many cases, applications manage their components by themselves, configuring or creating new services as needed. When you use an application's original installer tool to remove the application, the tool can usually clean up and remove any remaining pieces. However, if you've changed the application's configuration since you installed the tool, you might have to manually change the configuration back to the original for the installer tool to successfully remove the application.

Windows 2000 uses the Control Panel Add/Remove Programs applet to add and remove application, network, and data services. However, I strongly recommend that you don't try to manually remove a service by tracking down its code in the \winnt directory and deleting it. Doing so can have unpredictable but negative effects on your server's operation. Alternatively, the resource kit provides an array of tools that you can use for service-management tasks. Table 3 provides a list of resource kit tools for managing system and application services.

Table 3 Resource Kit Tools for Managing System and Application Services

Tool

Full Name

Description

Function

Delsrv.exe*

Delete Service

Unregisters a service through the Windows Services Control Manager.

Manually removes parts of a service that the service's uninstallation program has left running on the system.

Instsrv.exe*

Service Installer

Installs and uninstalls services.

Gives a specific name to a new program service and installs it with the OS (e.g., creates an instance of Srvany to run an application in the background).

Netsvc.exe*

Command-line Service Controller

Lists, queries the status of, and controls the execution of services.

Locally and remotely controls services and retrieves status information.

Sc.exe*

Service Controller Tool

Interacts directly with the Windows Service Controller, giving you full access to services information through a command prompt.

Starts and stops services, tests problematic services locally or remotely, debugs newly installed services, creates and deletes services, alters properties, and queries services' status.

Sclist.exe*

Service List

Lists running, stopped, or all services on a local or a remote system.

Gives a quick status update about all system services, rather than individual services.

Srvany.exe

Applications as Services Utility

Runs any Windows application as a background service.

Loads applications automatically at boot and runs them unattended.

Srvinstw.exe

Service Installation Wizard

Installs and deletes services and device drivers.

Adds a new service or device driver either locally or remotely.

Svcacls.exe*

Service ACL Editor

Delegates services control through ACLs.

Grants, sets, revokes, and denies access to specific services.

Svcmon.exe

Service Monitoring Tool (SMT)

Monitors services locally or remotely and notifies you of any changes.

Polls for any changes to running services on your server, and uses SMTP or Exchange to notify you about stop and start events.

Smconfig.exe

SMT Configuration Wizard

Configures Svcmon to notify you of changes in services' status.

Configures which services Svcmon monitors and whom the tool notifies. (Svcmon.exe must be in your \%systemroot%\system32 directory.)

* A command-line utility

If you prefer to manage from a command prompt, the resource kit offers command-line versions of service-management tools that let you install and uninstall services' executable files, but only on the local machine. In addition, these tools require you to use the Service Controller (sc.exe) tool to start and set services' attributes. The Service Installation Wizard is a GUI tool that lets you install, start, and set services' attributes from one interface, even on remote servers. However, you should use this tool only with applications and services that don't have an install/uninstall program.

The resource kit's Srvany tool lets you run an end-user or other Windows application as a system service. (Some applications install as system services, but you have to force others to run this way.) Running Windows applications as system services lets you set an application to load automatically when the server boots, without requiring a user to log on. (However, you should test this configuration on a nonproduction system first—some applications don't function properly when forced to run as services.) The application runs in the background regardless of the security attributes of the current user. The resource kit includes instructions for how to install and use Srvany. For more information about Windows 2000's resource kit tools, invest in the resource kit and pay close attention to the Windows 2000 core Help files and the resource kit's documentation.

Learn the Basics

Take time to gain an understanding of Windows 2000 Server services and become familiar with the auxiliary Windows 2000 service-management tools available to you. This knowledge will help you analyze Windows 2000's default services configuration to determine your server's optimal configuration.

© 2002 Windows & .NET Magazine. All rights reserved.

Try a sample issue of Windows & .NET Magazine at: https://www.windowsitpro.com/sub.cfm?code=fsWI201XTN.

Windows & .NET Magazine UPDATE is a free email newsletter containing news, tips and other resources for Windows IT Professionals. Subscribe now at https://email.winnetmag.com/winnetmag/winnetmag_prefctr.asp.

We at Microsoft Corporation hope that the information in this work is valuable to you. Your use of the information contained in this work, however, is at your sole risk. All information in this work is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Microsoft Corporation. Microsoft Corporation shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages. All prices for products mentioned in this document are subject to change without notice.

Link Click to order