A
service is a specialized program that performs a function to support
other programs. Many services operate at a very low level (by
interacting directly with hardware, for example) and need to run even
when no user is logged on. For this reason, they are often run by the System
account (which has elevated privileges) rather than by ordinary user
accounts. In this section, you'll learn how to view the installed
services; start, stop, and configure them; and install or remove them.
We'll also take a closer look at some of the services used in Windows 7
and show you how to configure them to your advantage. A new (and great,
we might add) method for viewing services on your computer is through
the Services tab of Task Manager.
1. Using the Services Console
You manage services with the Services snap-in for Microsoft Management Console, shown in Figure 1. To view this snap-in, type services.msc at a command prompt. (You must have administrator
privileges to gain full functionality in the Services console. Running
as a standard user, you can view service settings, but you can't start
or stop most services, change the startup type, or make any other
configuration changes.)
The Extended and Standard views in the Services console (selectable by clicking a tab near the bottom of
the window) have a single difference: the Extended view provides
descriptive information of the selected service in the space at the left
edge of the details pane. This space also sometimes includes links for
starting, stopping, or pausing the selected service. Unless you need to
constrain the console display to a small area of your screen, you'll
probably find the Extended view preferable to the Standard view.
The Services console offers plenty of information in its clean display. You can sort the contents of any column
by clicking the column title, as you can do with other similar lists.
To sort in reverse order, click the column title again. In addition, you
can do the following:
Start, stop, pause, resume, or restart the selected service, as described in the following section
Display the properties dialog box for the selected service, in which you can configure the service and learn more about it
Most of the essential
services are set to start automatically when your computer starts, and
the operating system stops them as part of its shutdown process. But
sometimes you might need to manually start or stop a service. For
example, you might want to start a seldom-used service on the rare
occasion when you need it. (Because running services requires system
resources such as memory, running them only when necessary can improve
performance.) On the other hand, you might want to stop a service
because you're no longer using it. A more common reason, however, for
stopping a service is because it isn't working properly. For example, if
print jobs get stuck in the print queue, sometimes the best remedy is
to stop and then restart the Print Spooler service.
If a service allows pausing, try pausing and then continuing the service as your first step instead of stopping the service. Pausing can solve certain problems without canceling jobs in process or resetting connections.
|
2. Starting and Stopping Services
Not all services allow you to change their status. Some prevent stopping and starting
altogether, whereas others permit stopping and starting but not pausing
and resuming. Some services allow these permissions to only certain
users or groups. For example, most services allow only members of the
Administrators group to start or stop them. Which status changes are
allowed and who has permission to make them are controlled by each
service's discretionary access control list (DACL), which is established
when the service is created on a computer.
To change a service's
status, select it in the Services console. Then click the appropriate
link in the area to the left of the service list (if you're using the
Extended view and the link you need appears there). Alternatively, you
can use the VCR-style controls on the toolbar, or right-click and choose
the corresponding command.
You can also change a
service's status by opening its properties dialog box and then clicking
one of the buttons on the General tab. Taking the extra step of opening
the properties dialog box to set the status has only one advantage: you
can specify start parameters when you start a service using this method. This is a rare requirement.
3. Configuring Services
To review or modify the
way a service starts up or what happens when it doesn't start properly,
view its properties dialog box. To do that, simply double-click the
service in the Services console. Figure 2 shows an example.
3.1. Setting Startup Options
On the General tab of the properties dialog box (shown in Figure 2), you specify the startup type:
Automatic (Delayed Start) The service starts shortly after the computer starts in order to improve startup performance and user experience.
Automatic The service starts when the computer starts.
Manual The service doesn't start automatically at startup, but it can be started by a user, program, or dependent service.
Disabled The service can't be started.
You'll find other startup options on the Log On tab of the properties dialog box, as shown in Figure 3.
Note:
If you specify a
logon account other than the Local System account, be sure that account
has the requisite rights. Go to the Local Security Policy console (at a
command prompt, type secpol.msc), and then go to Security Settings\Local
Policies\User Rights Assignment and assign the Log On As A Service
right to the account.
3.2. Specifying Recovery Actions
For a variety of
reasons—hardware not operating properly or a network connection being
down, for example—a service that's running smoothly might suddenly stop.
Settings on the Recovery tab of the properties dialog box, shown in Figure 4, allow you to specify what should happen if a service fails.
You might want to
perform a different action the first time a service fails than on the
second or subsequent failures. The Recovery tab enables you to assign a
particular response to the first failure, the second failure, and all
subsequent failures, from among these options:
Take No Action
The service gives up trying. In most cases, the service places a
message in the event log. (Use of the event log depends on how the
service was programmed by its developers.)
Restart The Service The computer waits for the time specified in the Restart Service After box to elapse and then tries to start the service.
Run A Program
The computer runs the program that you specify in the Run Program box.
For example, you could specify a program that attempts to resolve the
problem or one that alerts you to the situation.
Restart The Computer
Drastic but effective, this option restarts the computer after the time
specified in the Restart Computer Options dialog box elapses. In that
dialog box, you can also specify a message to be broadcast to other
users on your network, warning them of the impending shutdown.
3.3. Viewing Dependencies
Many services
rely on the functions of another service. If you attempt to start a
service that depends on other services, Windows first starts the others.
If you stop a service upon which others are dependent, Windows also
stops those services. Before you either start or stop a service,
therefore, it's helpful to know what other services your action might
affect. To obtain that information, go to the Dependencies tab of a service's properties dialog box, shown in Figure 5.
3.4. Determining the Name of a Service
As you view the properties
dialog box for different services, you might notice that the service
name (shown at the top of the General tab) is often different from the
name that appears in the Services console (the display name) and that
neither name matches the name of the service's executable file. (In
fact, the executable for many services is either Services.exe or
Svchost.exe.) The General tab (shown in Figure 22-14 on Section 22.5.3.1) shows all three names.
So how does this
affect you? When you work in the Services console, you don't need to
know anything other than a service's display name to find it and work
with it. But if you use the Net command to start and stop services, you
might find using the actual service name more convenient; it is often
much shorter than the display name. You'll also need the service name if
you're ever forced to work with a service's registry entries, which can
be found in the HKLM\System\CurrentControlSet\Services\service subkey (where service is the service name).
And what about the
executable name? You might need it if certain users have problems
running a service; in such a case, you need to find the executable and
check its permissions. Knowing the executable name can also be useful,
for example, if you're using Windows Task Manager to determine why your
computer seems to be running slowly. Although the Processes tab and the
Services tab show the display name (under the Description heading),
because of the window size it's sometimes easier to find the more
succinct executable name.
4. Managing Services from Task Manager
Using the Services
tab in Windows Task Manager, you can start and stop services and view
several important aspects of the services, both running and available,
on your computer. You can also use this as a shortcut to the Services
console.
Access Task Manager by
right-clicking the taskbar and clicking Start Task Manager, by pressing
Ctr+Alt+Delete and clicking Start Task Manager, or by pressing
Ctrl+Shift+Esc. The Services tab is shown in Figure 6.
To start or stop a service, right-click its name on the Services tab and then click Start Service or Stop Service.
Using the Services tab,
you can also associate a running service with its process identifier
(PID) and then further associate that PID with other programs and
services being run under that PID. For example, Figure 6
shows several services running with PID 512. Right-clicking one of the
services with PID 512 gives two options, one to stop the service and one
called Go To Process. By clicking Go To Process, the Processes tab is
opened with the particular process highlighted.
Note:
Most service-related
processes run under an account other than your own and therefore aren't
available when you attempt to use the Go To Process option. To view
these processes, click the Show Processes From All Users option on the
Processes tab in Task Manager.