Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Windows service

From Wikipedia, the free encyclopedia
Component of the Microsoft Windows operating system

InWindows NT operating systems, aWindows service is acomputer program thatoperates in the background.[1] It is similar in concept to aUnixdaemon.[1] A Windows service must conform to the interface rules and protocols of theService Control Manager, 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.[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 systemsinclude numerous services which run in context of threeuser accounts: System, Network Service and Local Service. These Windows components are often associated withHost 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 toWindows Vista, services installed as an "interactive service" could interact with Windowsdesktop and show agraphical user interface. In Windows Vista, however, interactive services are deprecated and may not operate properly, as a result ofWindows Service hardening.[3][4]

Administration

[edit]

Windows administrators can manage services via:

Services snap-in

[edit]

The Services snap-in, built uponMicrosoft Management Console, can connect to the local computer or a remote computer on the network, enabling users to:[1]

  • view a list of installed services along with service name, descriptions and configuration
  • start, stop, pause or restart services[5]
  • specify service parameters when applicable
  • change the startup type. Acceptable startup types include:
    • Automatic: The service starts at system startup.
    • Automatic (Delayed): The service starts a short while after the system has finished starting up. This option was introduced inWindows Vista in an attempt to reduce the boot-to-desktop time. However, not all services support delayed start.[6]
    • Manual: The service starts only when explicitly summoned.
    • Disabled: The service is disabled. It will not run.
  • change theuser 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 aCSV file

Command line

[edit]
sc
DevelopersMicrosoft, ReactOS Contributors
Operating systemWindows,ReactOS
TypeCommand
LicenseWindows:Proprietarycommercial software
ReactOS:GNU General Public License
Websitedocs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc754599(v%3dws.11)

Thecommand-line tool to manage Windows services is sc.exe. It is available for all versions ofWindows NT.[7] This utility is included withWindows XP[8] and later[9] and also inReactOS.

Thesc command's scope of management is restricted to the local computer. However, starting withWindows Server 2003, not only cansc do all that the Services snap-in does, but it can also install and uninstall services.[9]

Thesc command duplicates some features of thenet command.[10]

The ReactOS version was developed by Ged Murphy and is licensed under theGPL.[11]

sc sub-commands
NameDescriptionWindows supportReactOS support
queryShow service statusYesYes
queryexShow extended service info (e.g. pid, flags)YesYes
startStart a serviceYesYes
pausePause a serviceYesYes
interrogateSend an INTERROGATE control request to a serviceYesYes
continueContinue a serviceYesYes
stopStop a serviceYesYes
configpermanently change the service configurationYesYes
descriptionChange a service descriptionYesYes
failureChange the actions taken by a service upon failureYesYes
failureflagYesNo
sidtypeYesNo
privsYesNo
managedaccountYesNo
qcShow the service config (e.g. dependencies, full path etc.)YesYes
qdescriptionQuery a service descriptionYesYes
qfailureYesNo
qfailureflagYesNo
qsidtypeYesNo
qprivsYesNo
qtriggerinfoYesNo
qpreferrednodeYesNo
qmanagedaccountYesNo
qprotectionYesNo
quserserviceYesNo
deleteDelete a serviceYesYes
createCreate a serviceYesYes
controlSend a control to a serviceYesYes
sdshowDisplay a service's security descriptor using SDDLYesYes
sdsetSets a service's security descriptor using SDDLYesYes
showsidYesNo
triggerinfoYesNo
preferrednodeYesNo
GetDisplayNameShow the service DisplayNameYesYes
GetKeyNameShow the service ServiceKeyNameYesYes
EnumDependShow the service DependenciesYesYes
bootYesNo
LockYesNo
QueryLockYesNo

Examples

[edit]

The following example enumerates the status for active services & drivers.[12]

C:\>sc query

The following example displays the status for theWindows Event log service.[12]

C:\>sc query eventlog

PowerShell

[edit]

The Microsoft.PowerShell.Management PowerShell module (included with Windows) has several cmdlets which can be used to manage Windows services:

Other management tools

[edit]

Windows also includes components that can do a subset of what the snap-in, Sc.exe and PowerShell do. Thenet command can start, stop, pause or resume a Windows service.[21] 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.

Installation

[edit]

Windows services are installed and removed via *.INF setup scripts bySetupAPI; an installed service can be started immediately following its installation, and a running service can be stopped before its deinstallation.[22][23][24]

Development

[edit]

Writing native services

[edit]

For a program to run as a Windows service, the program needs to be written to handle service start, stop, and pause messages from theService Control Manager (SCM) through theSystem Services API. SCM is the Windows component responsible for managing service processes.

Wrapping applications as a service

[edit]

TheWindows Resource Kit forWindows NT 3.51,Windows NT 4.0 andWindows 2000 provides tools to control the use and registration of services:SrvAny.exe acts as aservice 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.[25]

See also

[edit]
Windows services
Concept

References

[edit]
  1. ^abc"Services overview".TechNet. Microsoft. Retrieved29 March 2013.
  2. ^"Services".Microsoft Developer Network. Microsoft. Retrieved29 March 2013.
  3. ^"New Elevation PowerToys for Windows Vista".TechNet Magazine.Microsoft. June 2008. Retrieved21 June 2013.The service CmdAsSystem is configured as interactive whose support is being deprecated. The service may not function properly. The problem is that this script tries to create and start an interactive service. Interactive services will not function correctly due to Session 0 Isolation in Windows Vista.
  4. ^"Services in Windows".MSDN.Microsoft. 18 October 2010. Retrieved21 June 2013.
  5. ^"Start, stop, pause, resume, or restart a service".TechNet. Microsoft. Retrieved29 March 2013.
  6. ^"ServiceInstaller.DelayedAutoStart Property (System.ServiceProcess)". Microsoft. Retrieved28 November 2017See Remarks section{{cite web}}: CS1 maint: postscript (link)
  7. ^"How to create a Windows service by using Sc.exe".Support. Microsoft. 11 September 2011. Retrieved29 March 2013.
  8. ^"Command-line reference A-Z: SC".TechNet.Microsoft. Retrieved8 January 2014.
  9. ^ab"Command-Line Reference: Sc".TechNet.Microsoft. Retrieved8 January 2014.Windows 7, Windows 8, Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Vista
  10. ^SC - Service Control - Windows CMD - SS64.com
  11. ^reactos/sc.c at master · reactos/reactos · GitHub
  12. ^abMS-DOS and Windows command line sc command
  13. ^"Get-Service".TechNet. Microsoft. Retrieved29 March 2013.
  14. ^"New-Service".TechNet. Microsoft. Retrieved29 March 2013.
  15. ^"Restart-Service".TechNet. Microsoft. Retrieved29 March 2013.
  16. ^"Resume-Service".TechNet. Microsoft. Retrieved29 March 2013.
  17. ^"Set-Service".TechNet. Microsoft. Retrieved29 March 2013.
  18. ^"Start-Service".TechNet. Microsoft. Retrieved29 March 2013.
  19. ^"Stop-Service".TechNet. Microsoft. Retrieved29 March 2013.
  20. ^"Suspend-Service".TechNet. Microsoft. Retrieved29 March 2013.
  21. ^"Start, stop, pause, resume, or restart a service".TechNet.Microsoft. Retrieved8 January 2014.
  22. ^"INF AddService Directive". Microsoft. Retrieved10 July 2017.
  23. ^"SetupInstallServicesFromInfSection function".MSDN. Microsoft. Retrieved10 July 2017.
  24. ^"SetupInstallServicesFromInfSectionEx function".MSDN. Microsoft. Retrieved10 July 2017.
  25. ^"How To Create a User-Defined Service".Support. Microsoft. Retrieved29 March 2013.

Further reading

[edit]

External links

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands
Management
tools
Apps
Shell
Services
File systems
Server
Architecture
Security
Compatibility
API
Games
Discontinued
Games
Apps
Others
Spun off to
Microsoft Store
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Windows_service&oldid=1237793043"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp