HOME

TheInfoList



OR:

In
Windows NT Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system. The first version of Win ...
operating systems, a Windows service is a
computer program A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components. A computer program ...
that operates in the background. It is similar in concept to a
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, an ...
daemon Daimon or Daemon (Ancient Greek: , "god", "godlike", "power", "fate") originally referred to a lesser deity or guiding spirit such as the daimons of ancient Greek religion and Greek mythology, mythology and of later Hellenistic religion and Hell ...
. A Windows service must conform to the interface rules and protocols of the
Service Control Manager Service Control Manager (SCM) is a special system process under the Windows NT family of operating systems, which starts, stops and interacts with Windows service processes. It is located in the %SystemRoot%\System32\services.exe executable. Service ...
, the component responsible for managing Windows services. It is the Services and Controller app, services.exe, that launches all the services and manages their actions, such as start, end, etc. Windows services can be configured to start when the operating system is started and run in the background as long as Windows is running. Alternatively, they can be started manually or by an event. Windows NT operating systems include numerous services which run in context of three
user account A user is a person who utilizes a computer or network service. A user often has a user account and is identified to the system by a username (or user name). Other terms for username include login name, screenname (or screen name), accoun ...
s: System, Network Service and Local Service. These Windows components are often associated with Host Process for Windows Services. Because Windows services operate in the context of their own dedicated user accounts, they can operate when a user is not logged on. Prior to
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
, services installed as an "interactive service" could interact with Windows
desktop A desktop traditionally refers to: * The surface of a desk (often to distinguish office appliances that fit on a desk, such as photocopiers and printers, from larger equipment covering its own area on the floor) Desktop may refer to various compu ...
and show a
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inst ...
. In Windows Vista, however, interactive services are deprecated and may not operate properly, as a result of
Windows Service hardening There are a number of security and safety Features new to Windows Vista, features new to Windows Vista, most of which are not available in any prior Microsoft Windows operating system release. Beginning in early 2002 with Microsoft's announcement ...
.


Administration

Windows administrators can manage services via: * The Services snap-in (found under ''Administrative Tools'' in Windows Control Panel) * Sc.exe *
Windows PowerShell PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-so ...


Services snap-in

The Services snap-in, built upon
Microsoft Management Console Microsoft Management Console (MMC) is a component of Microsoft Windows that provides system administrators and advanced users an interface for configuring and monitoring the system. It was first introduced in 1998 with the Option Pack for Window ...
, 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: **''Automatic'': The service starts at system logon. **''Automatic (Delayed)'': The service starts a short while after the system has finished starting up. This option was introduced in
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
in an attempt to reduce the boot-to-desktop time. However, not all services support delayed start. **''Manual'': The service starts only when explicitly summoned. **''Disabled'': The service is disabled. It will not run. * change the
user account A user is a person who utilizes a computer or network service. A user often has a user account and is identified to the system by a username (or user name). Other terms for username include login name, screenname (or screen name), accoun ...
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


Command line

The
command-line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
tool to manage Windows services is sc.exe. It is available for all versions of
Windows NT Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system. The first version of Win ...
. This utility is included with
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
and later and also in ReactOS. The sc command's scope of management is restricted to the local computer. However, starting with
Windows Server 2003 Windows Server 2003 is the sixth version of Windows Server operating system produced by Microsoft. It is part of the Windows NT family of operating systems and was released to manufacturing on March 28, 2003 and generally available on April 24, 2 ...
, not only can sc do all that the Services snap-in does, but it can also install and uninstall services. The sc command duplicates some features of the
net Net or net may refer to: Mathematics and physics * Net (mathematics), a filter-like topological generalization of a sequence * Net, a linear system of divisors of dimension 2 * Net (polyhedron), an arrangement of polygons that can be folded up ...
command. The ReactOS version was developed by Ged Murphy and is licensed under the
GPL The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general u ...
.


Examples

The following example enumerates the status for active services & drivers.MS-DOS and Windows command line sc command
/ref> C:\>sc query The following example displays the status for the Windows Event log service. C:\>sc query eventlog


PowerShell

The Microsoft.PowerShell.Management PowerShell module (included with Windows) has several cmdlets which can be used to manage Windows services: * Get-Service * New-Service * Restart-Service * Resume-Service * Set-Service * Start-Service * Stop-Service * Suspend-Service


Other management tools

Windows also includes components that can do a subset of what the snap-in, Sc.exe and PowerShell do. The
net Net or net may refer to: Mathematics and physics * Net (mathematics), a filter-like topological generalization of a sequence * Net, a linear system of divisors of dimension 2 * Net (polyhedron), an arrangement of polygons that can be folded up ...
command can start, stop, pause or resume a Windows service. In Windows Vista and later,
Windows Task Manager Task Manager, previously known as Windows Task Manager, is a task manager, system monitor, and startup manager included with Microsoft Windows systems. It provides information about computer performance and running software, including name of r ...
can show a list of installed services and start or stop them. MSConfig can enable or disable (see startup type description above) Windows services.


Installation

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.


Development


Writing native services

For a program to run as a Windows service, the program needs to be written to handle service start, stop, and pause messages from the
Service Control Manager Service Control Manager (SCM) is a special system process under the Windows NT family of operating systems, which starts, stops and interacts with Windows service processes. It is located in the %SystemRoot%\System32\services.exe executable. Service ...
(SCM) through th
System Services API
SCM is the Windows component responsible for managing service processes.


Wrapping applications as a service

The
Windows Resource Kit Resource Kit is a term used by Microsoft for a set of software resources and documentation released for their software products, but which is not part of that product. Resource kits offer supplementary resources such as technical guidance, compatibi ...
for Windows NT 3.51,
Windows NT 4.0 Windows NT 4.0 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It is the direct successor to Windows NT 3.51, which was released to manufacturing on July 31, 1996, and then to retail ...
and
Windows 2000 Windows 2000 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It was the direct successor to Windows NT 4.0, and was released to manufacturing on December 15, 1999, and was officiall ...
provides tools to control the use and registration of services: SrvAny.exe acts as a service wrapper to handle the interface expected of a service (e.g. handle service_start and respond sometime later with service_started or service_failed) and allow any executable or script to be configured as a service. Sc.exe allows new services to be installed, started, stopped and uninstalled.


See also

; Windows services * *
Windows Service Hardening There are a number of security and safety Features new to Windows Vista, features new to Windows Vista, most of which are not available in any prior Microsoft Windows operating system release. Beginning in early 2002 with Microsoft's announcement ...
* svchost.exe ; Concept *
Background process A background process is a computer process that runs ''behind the scenes'' (i.e., in the background) and without user intervention. Typical tasks for these processes include logging, system monitoring, scheduling, and user notification. The backgr ...
** Daemon (computing) **
DOS Protected Mode Services DOS Protected Mode Services (DPMS) is a set of extended DOS memory management services to allow DPMS-enabled DOS drivers to load and execute in extended memory and protected mode. Not being a DOS extender by itself, DPMS is a minimal set of ex ...
**
Terminate and stay resident program A terminate-and-stay-resident program (commonly TSR) is a computer program running under DOS that uses a system call to return control to DOS as though it has finished, but remains in computer memory so it can be reactivated later. This technique ...
** Device driver * Operating system service management **
Service Control Manager Service Control Manager (SCM) is a special system process under the Windows NT family of operating systems, which starts, stops and interacts with Windows service processes. It is located in the %SystemRoot%\System32\services.exe executable. Service ...
**
Service Management Facility Service Management Facility (SMF) is a feature of the Solaris operating system as of version 10 and OpenSolaris-descendant illumos with its illumos distributions, that creates a supported, unified model for services and service management on each ...
* Service wrapper


References


Further reading

* * David B. Probert
Windows Service Processes


External links


Windows Sysinternals: Autoruns for Windows v13.4
– An extremely detailed query of services
Service Management With Windows Sc From Command Line
– Windows Service Management Tutorial
Windows Service Manager Tray
{{Windows commands Process (computing)