Pcornel
Windows

Windows Services

Cheat sheet · https://pcornel.dk/topic.php?topic=377

Back to the Topic

Answer

Windows Services explains long-running or event-triggered background workloads managed through the Service Control Manager (SCM). The SCM maintains installed-service configuration and controls service start/stop/status; a service can run without an interactive user logon and can execute under a dedicated service identity.

Remember

  • Installed service ≠ running service ≠ healthy application function.
  • Startup type controls how a service may be started; it is not the same as current runtime state.
  • A service account defines security context and network/local rights available to the service process.
  • Dependencies affect start/order relationships but do not automatically prove dependency health.
  • One process can host one or multiple services, so service identity and PID must both be checked.

First checks

  • Get-Service <name> | fl * — status, start type, dependencies
  • Get-CimInstance Win32_Service -Filter "Name='<name>'" | Select StartName,PathName,StartMode — account, path and mode
  • sc.exe qc <name> — configuration in CMD
  • Get-WinEvent -FilterHashtable @{LogName='System';ProviderName='Service Control Manager'} -MaxEvents 20 — SCM events

Commands

sc.exe qc <service>
Shows a service's configuration: start type, binary path, dependencies and the account it runs as.
sc.exe query <service>
Shows the state of a Windows service: running, stopped or pending, and its exit code.
services.msc
Opens the Windows Services management console, a GUI for querying installed services and—subject to rights—starting, st…
sc.exe
Windows command-line service control/configuration utility that maps to Service Control Manager functions. It can query…
Start-Service
PowerShell cmdlet that sends a start request for one or more Windows services. It changes service lifecycle state and s…
Stop-Service
PowerShell cmdlet that requests one or more Windows services to stop. It is a state-changing control action whose depen…
Get-Service
PowerShell cmdlet that gets Windows service objects and their SCM-reported status. It is a read-oriented starting point…

Verify in this order

SCM reads config → starts dependencies → starts the service under its account → Running

Where it usually breaks

First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.

Windows Services reference map

ItemMeaningEvidence boundary
SCM configurationInstalled service recordname, binary, start type, account, dependencies
Runtime stateStopped/Start Pending/Running/etc.lifecycle status reported to SCM
Service processExecutable/PIDruntime container; may host multiple services
Service accountSecurity identitylocal/network access context
Application healthActual provided functionmust be tested beyond service RUNNING state

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=377

Confirmation

Confirm action

Continue?