Windows service

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In Windows NT operating systems, a Windows service is a computer program that operates in the background.[1] It is similar in concept to a Unix daemon.[1] A Windows service must conform to the interface rules and protocols of the Service Control Manager, the component responsible for managing Windows services.[2]

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 accounts: System, Network Service and Local Service. These Windows components are often associated with Host Process for Windows Services.

Contents

Administration [edit]

Installed services can be managed by the Services snap-in (found under Administrative Tools in Windows Control Panel), Windows PowerShell or by several command line tools included in Microsoft Windows. Other Windows components such as MSConfig and Windows Task Manager (in Windows Vista and later) have limited Service management features.

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:[1]

  • See a list of installed service along with service name, descriptions and configuration
  • Start, stop, pause or restart services[3]
  • 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 in an attempt to reduce the boot-to-desktop time. However, not all services support delayed start.[4]
    • Manual: The service starts only when explicitly summoned.
    • 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 a CSV file

The command line peer of the Services snap-in is sc.exe, a utility which was formerly a part of Windows Resource Kit.[5] Sc.exe's scope of management is restricted to the local computer. However, starting with Windows Server 2003, not only can sc.exe do all that the Services snap-in does, but can also install and uninstall services.[6]

Windows PowerShell can intrinsically manage Windows services via the following cmdlets:

In addition to these three, Windows also includes components that can do a subset of what the above can do. In Windows Vista and later, Windows Task Manager can show a list of installed services and start or stop them. MSConfig can enable or disable (see startup type description above) Windows services.

Development [edit]

A Windows service is created using development tools such as Microsoft Visual Studio or Embarcadero Delphi. In order to be a Windows service, a program needs to be written in such a way that it can handle start, stop, and pause messages from the Service Control Manager. Service Control Manager is a component of Windows which is responsible for starting and stopping services.

The Windows Resource Kit for Windows NT 3.51, Windows NT 4.0 and Windows 2000 provides tools to control the use and registration of services: svrany.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 (Service Control) allows new services to be installed, started, stopped and uninstalled.[15]

See also [edit]

Windows services
Concept

References [edit]

  1. ^ a b c "Services overview". TechNet. Microsoft. Retrieved 29 March 2013. 
  2. ^ "Services". Microsoft Developer Network. Microsoft. Retrieved 29 March 2013. 
  3. ^ "Start, stop, pause, resume, or restart a service". TechNet. Microsoft. Retrieved 29 March 2013. 
  4. ^ "ServiceInstaller.DelayedAutoStart Property (System.ServiceProcess)". Microsoft. Retrieved April 2013See Remarks section 
  5. ^ "How to create a Windows service by using Sc.exe". Support. Microsoft. 11 September 2011. Retrieved 29 March 2013. 
  6. ^ "Sc". TechNet. Microsoft. Retrieved 29 March 2013. 
  7. ^ "Get-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  8. ^ "New-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  9. ^ "Restart-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  10. ^ "Resume-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  11. ^ "Set-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  12. ^ "Start-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  13. ^ "Stop-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  14. ^ "Suspend-Service". TechNet. Microsoft. Retrieved 29 March 2013. 
  15. ^ "How To Create a User-Defined Service". Support. Microsoft. Retrieved 29 March 2013. 

Further reading [edit]