Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Windows Services

Definition +
Window Services management +
Services in Windows desktop testing +
Standard Windows Services +
Difference between windows service and generic application +
Differences between Windows Services and Scheduled Tasks +
Useful Links +

Definition

Windows Services are core components of the Microsoft Windows operating system and
enable the creation and management of long-running processes. They are intended to
provide operating system features such as web serving, event logging, file serving, printing
or error reporting. Not all Services are developed by Microsoft. Some applications and
drivers install their Services.

Unlike regular software that is launched by the end user and only runs when the user is
logged on, Windows Services can start without user intervention and may continue to run
long after the user has logged off. The services run in the background and will usually kick in
when the machine is booted. Developers can create Services by creating applications that
are installed as a Service, an option ideal for use on servers when long-running functionality
is needed without interference with other users on the same system.

The services manage a wide variety of functions including network connections, speaker
sound, data backup, user credentials and display colors. Windows Services perform a similar
function as UNIX daemons.

Windows Services are installed and removed via *.INF setup scripts by SetupAPI. An
installed service can be started immediately following its installation and a running service
can be stopped before its deinstallation.

Windows Services management

Windows administrators can manage services via:


 The Services snap-in using Services Panel
 Task Manager – Services tab
 Command Line using sc.exe tool
 Windows PowerShell

Managing Windows Services in Services Panel

Windows has the Services panel to manage the services that are running on your computer
using a user interface. User can easily get there at any point by simply hitting WIN + R on the
keyboard to open the Run dialog and typing in services.msc.
The Service Control Manager maintains a database of installed services and driver services
and provides a unified and secure means of controlling them. The database includes
information on how each service or driver service should be started. It also enables system
administrators to customize security requirements for each service and thereby control
access to the service.

Fig.1.

The Services snap-in, built upon Microsoft Management Console, can connect to the local
computer or a remote computer on the network, enabling users to:

 View a list of installed services along with service name, descriptions and
configuration;
 Start, stop, pause or restart services;
 Specify service parameters when applicable;
 Change the startup type. Acceptable startup types include:
o Automatic: The service starts at system logon;
o Automatic (Delayed): The service starts a short while after the system has
finished starting up;
o Manual: The service starts only when explicitly summoned;
o Disabled: The service is disabled. It will not run;
 Change the user account context in which the service operates;
 Configure recovery actions that should be taken if a service fails;
 Inspect service dependencies, discovering which services or device drivers depend
on a given service or upon which services or device drivers a given service depends;
 Export the list of services as a text file or as a CSV file.

Fig.1.
The Services panel is simple: there are a list of services, a status column to show whether it
is running or not, and more information like name, description, and the startup type of the
service. User will notice that not every service is running all the time.

Managing Windows Services in Task Manager

Task manager in Windows 8 or higher has a Services tab, which allows user to stop and start
services, also comes with a “Search online” option and even more useful, the “Go to details”
option.

Fig.2.

Managing Windows Services from the Command Prompt

Some operations just cannot be done through the graphical user interface. If user wants to
delete a Service, for example, it can be done only by using the command line.

The command-line tool to manage Windows services is sc.exe.


Fig.3.

The sc.exe without any options calls the list of available options. Using them user can
manage Windows Services, including deleting action (it is recommended to use this option
only if user’s system has a malware).

Examples of command line commands

The command sc queryex type=service state=all displays the list of all Windows Services.
The command sc queryex type=service state=active displays the list of running Services.
The command sc query “MyServiceName” displays the status of the given Service.

Managing Windows Services in Power Shell

The Microsoft.PowerShell.Management PowerShell module (included with Windows) has


several cmdlets which can be used to manage Windows services.
Fig.4.

The list of cmdlets:


 Get-Service;
o Gets objects that represent the services on a computer, including running
and stopped services. By default, when Get-Service is run without
parameters, all the local computer's services are returned;
 New-Service;
o Creates a new entry for a Windows service in the registry and in the service
database. A new service requires an executable file that runs during the
service;
 Restart-Service;
o Sends a stop message and then a start message to the Windows Service
Controller for a specified service. If a service was already stopped, it is started
without notifying you of an error;
 Resume-Service;
o Sends a resume message to the Windows Service Controller for each of the
specified services. If a service is suspended, it resumes. If it is currently
running, the message is ignored;
 Set-Service;
o Changes the properties of a service such as the Status, Description,
DisplayName, and StartupType;
o Set-Service can start, stop, suspend, or pause a service;
 Start-Service;
o Sends a start message to the Windows Service Controller for each of the
specified services. If a service is already running, the message is ignored
without error;
 Stop-Service;
o Sends a stop message to the Windows Service Controller for each of the
specified service;.
o User can specify the services by their service names or display names the
service that user want to stop;
 Suspend-Service;
o Sends a suspend message to the Windows Service Controller for each of the
specified services. While suspended, the service is still running, but its action
is stopped until resumed.

Services in Windows desktop testing

A desktop application is a program that runs independently in a desktop operating system.


Unlike web application, desktop one requires sufficient hardware resources to function.
They are more perplexing to control since certain apps are developed for certain
environments and configurations.
In desktop app testing, you need to pay close attention to installation as well as
uninstallation tests to fully cover all the files, components which were installed. Very often a
desktop application installs Services as well or can use some existing standard Windows
Services.
When testing a Windows desktop application a test engineer need to check:
 If some new service were installed during an installation procedure;
 How a new installed services works with an operating system (resources usage,
performance, etc.);
 How an application works with existing Windows Services;
 How an application will work in cases:
o When own application’s service was stopped;
o When windows services which were used for an application were stopped;
o When services which are used with application were removed;
 If installed with application services were removed after uninstalling procedure.

In some case new hardware could install additional services with drivers. In this case a test
engineer needs to check how a new hardware or a device will work with stopped or deleted
services as well.

Service testing can be a part of automation or unit testing.


Typically, one assembly for the Service is created and another one for what the Service
does.

Standard Windows Services

Examples of standard Windows Services

Active Directory Service – Active Directory is a service Microsoft developed for Windows
networks. It is included by default in most Microsoft Windows Server systems. Active
Directory oversees centralized domain management and identity-related functions.

Prefetch and Superfetch Service – Speeds up operating system and application startup by
caching to RAM frequently used files, libraries and application components. It does this by
monitoring application usage and behavior.

Background Intelligent Transfer Service – This service facilitates throttled, prioritized and
asynchronous file transfer between machines via idle bandwidth. It plays a key role in the
delivery of software updates from servers to clients as well as in the transfer of files on
Microsoft’s instant messaging applications.

DNS Client Service – This service resolves domain names to IP addresses and locally caches
this data.

Computer Browser Service – It allows users to easily locate shared resources on


neighboring computers. All information is aggregated on one of the computers (referred to
as the Master Browser) and other computers contact this machine for information on
shared resources.

Internet Connection Sharing (ICS) Service – ICS enables the use of one device connected to
the internet as an access point for other devices. Access could be through Ethernet
broadband, cellular service or another gateway.

Routing and Remote Access Service – This service makes it possible to create applications
that manage the remote access and routing capabilities of the Windows operating system. It
allows the machine to act as a network router.
The full list of standard Windows Services

See by Link - Standard Windows Services

Differences between Windows Services and Regular Applications

 Launch Mechanism – A regular application is manually launched by the end user


from the desktop or Start Menu. Windows Services start when the machine is
switched on. Note however that regular applications can be added to the Startup
folder in the Start Menu in which case they would start automatically once the
operating system startup is complete.
 User Interface – Unlike regular applications, Windows Services do not have a user
interface; they run in the background and the user does not directly interact with
them. A Windows Service does not stop when a user logs off the computer; a regular
application will.
 Multiple Instances – Only one instance of a Windows Service runs on a device.
Regular applications can allow multiple copies if several users are logged into the
same machine.
 Administrator Rights – Windows Services usually run under administrative privileges
even when a non-administrator user is logged in and using the computer. The
average Windows Service has more control over the machine compared to a regular
application.

Differences between Windows Services and Scheduled Tasks

A Task Scheduler enables a user to automatically perform routine tasks on a chosen


computer. Task Scheduler does this by monitoring whatever criteria a user chooses
(referred to as triggers) and then executing the tasks when those criteria are met.
A Windows Service is more appropriate for processes that have to respond to events at any
moment and not at specific and fix periods. That's why they are running all the time.

A Windows processes are the list of running applications and background processes on a
system.

Windows service Task scheduler

 Run as soon as computer started;  Run as on set time by user;


 Doesn’t required credential to run;  Need to provide credential while creating task to
 Need to configure on service panel; run on given time;

 Need to install service using command;  Need to create task on Task scheduler window;

 Need to uninstall service using  No need to install task like windows service;
command;  Task will open pop up whenever an application will
 It will not open pop up (UI- black console execute by task scheduler;
window) while running application.  It is more convenient to run application once a day
or after time period unlike windows service.

Useful Links

Windows Services WIKI


What are Windows Services
Standard Windows Services complete list

You might also like