Previous Table of Contents Next


Chapter 12
Maintaining Services And Device Drivers

  Managing Services With The Control Panel
  Managing Services From The Command Line
  Managing Devices With The Control Panel
  Finding Service And Device Dependencies

Windows NT, like previous versions of Windows, is an infinitely expandable operating system. The operating system consists of a core set of components and add-on services. Many third-party products enhance Windows NT Server’s capabilities by adding additional services. Without the services included in the base product and the additional third-party services, Windows NT would be much less useful to all of us. So, our first stop in this chapter will be a discussion on how to maintain NT’s added services. You will learn what services Windows NT Server provides, and how to control and configure these services using the Control Panel Services applet. In addition, you will learn how to use the command line to control and manage your services.

The next part of this chapter focuses on device drivers. A device driver expands the operating system’s capabilities (similar to a service in some aspects), but functions at a lower level. Device drivers include support for specific hardware components (network cards, video adapters, tape drives, and so forth) and low-level operating system objects (file system drivers, network protocols, and so on) used by higher-level services. Just like services, you need to maintain these device drivers to keep Windows NT up and running as expected. Troubleshooting device drivers and service-related problems are a couple of the more critical tasks of a system administrator, and most troubleshooting starts with the Control Panel Devices applet, which is where we’ll begin our exploration of device driver maintenance.

Unfortunately, device drivers cannot be configured from the Devices applet, nor do they have a command-line interface. You can, however, use the Registry Editor to learn more about a device driver’s dependencies and often configure device driver operations as well. This also applies to services. So, your last stop in this chapter will be to learn how to use the Registry Editor to accomplish these tasks.

Now that you know where we’re headed in this chapter, let’s get to work and learn how to maintain Windows NT services.

Maintaining Services

Services are the heart and soul of Windows NT and maintaining them in operating order is one of the most critical aspects of your administrative duties. In order to fully understand how to maintain Windows NT services, you need to know how a service is controlled. So, let’s begin our discussion with a look at the most important service—a service that not only controls other services, but is used to configure them as well. This service is called the Service Control Manager, and you will not find it in any of the regular administrative tools, nor will you find is listed as a controllable service. Yet, it does exist.

The purpose of the Service Control Manager is to control a service’s operating state. A service’s operating state is a report of its basic condition (whether it is running or not), as well as a control mechanism. Whenever a service is installed under Windows NT, the service must register itself with the Service Control Manager. This registration process exposes an interface to the Service Control Manager. The interface is used to send and receive messages between a service and the Service Control Manager. These messages are used to control the state of a service. There are basically six different service states, as follows:

  Start—When a service is inactive (i.e., not executing), the process of starting begins with the Service Control Manager loading the service into memory. At this time, the Service Control Manager also passes any command-line arguments supplied to the service, as well. As the service executes, it attaches the services control pathway to the Service Control Manager. This attached pathway provides an interface between the Service Control Manager and the service. As the service starts, it passes a start pending message to the Service Control Manager at preset intervals, informing the Service Control Manager of the service’s current operating state.
If the service fails to respond at timely intervals, it usually means the service is in a hung/pending state. This means the service either failed to start as expected, some initialization is taking longer than expected, or the service is unable to initialize itself at all. The Service Control Manager will allow some additional time for the service while in a pending state before it tries to terminate the service by sending a service stop message. But if the service is not responding to control messages, there is not much the Service Control Manager can do. The end result is usually a message from the Service Control Manager in the system event log and a service that is not functioning properly. In some cases, you can use the Task Manager to terminate a hung service. Some services, such as core operating system services, cannot be terminated by the Task Manager. In that case, your only real recourse is to reboot the computer to try and restart the service.


TIP:  While a service is initializing, it is not providing the function it was written to perform. It can only do this after it has completed its initialization. That is why it takes so long to log on to a system when you log on at the first opportunity. Even though you see the Ctrl+Alt+Del logon dialog box at system startup, the system really has not fully initialized the various services and is not ready to log you on. It takes about 5 minutes after the logon dialog is visible before all the services have reached a running state and are ready to go to work. If you have additional services, like Exchange Server or System Management Server, it might take even longer. It is a good idea to wait until the services have accomplished their initialization completely before you attempt to log on. Otherwise, you might cause a service to hang at startup. This is a rare occurrence, but it does happen from time to time.
  Stop—When a service receives a stop message from the Service Control Manager, it replies with a stop pending message. At this point, the service will attempt to disconnect any clients, close any open resources, and terminate gracefully. If this occurs as expected, the service sends a service stopped message to the Service Control Manager, and the service returns to an inactive state. Should an error occur, a message is usually placed in the system event log by the service before it terminates. If the service cannot terminate gracefully, it once more will be in a hung/pending state. If this occurs, your only recourse is to reboot the computer.
  Running—Once a service has initialized properly, it will return a service running message to the Service Control Manager. At this point, and only at this point, is the service ready to perform the task it was designed to provide.
  Pause—When a service receives the pause command from the Service Control Manager, the service responds with a pause pending message. At this point, the service might vary in its function. Most services in a paused state will not allow any new connections to be made to the service; however, the service will continue to support the currently connected clients. Some services (usually those that do not support multiple clients) might actually suspend the thread performing the work. In this case, not only are new clients not allowed to connect, but the old clients are put on hold, as well.
  Continue—Once a service has been paused, the Service Control Manager must send a service continue message to the service before the service can be restarted. The service responds by resuming any suspended threads and continuing its task as if nothing had ever occurred in the first place.
  Pending—A pending state occurs during a change from one state to another. This occurs, for example, whenever you start, stop, pause, or continue a service. Each time a service receives one of these commands, it takes time to accomplish the change. During this time, the service responds to the Service Control Manager with one or more service pending state messages. Each message informs the Service Control Manager how long the change is expected to take. If the time allotted by the service expires and the service no longer responds to Service Control Manager requests, the Service Control Manager will attempt to terminate the service by sending a service stop message. If that fails, the Service Control Manager will insert a message into the system event log informing you of the failure.

While you cannot control the operating state of the Service Control Manager, Windows NT includes an application to expose some of the Service Control Manager’s functionality. This application is the Control Panel Services applet, and it is our next topic of discussion.


Previous Table of Contents Next