Join our Newsletter — 33% off our NHI Course
Home› Guides› Windows Services and Service Account Security Guide: Choosing,…
Guide Endpoint Security

Windows Services and Service Account Security Guide: Choosing, Hardening and Monitoring Every Service Identity

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 15 min read
On this page

Every Windows service runs as an identity, and on most servers that identity is either far more powerful than the service needs or a domain user with a password nobody has changed in years. Windows offers nine practical choices, from LocalSystem and virtual accounts to standalone, group and delegated managed service accounts, and each behaves differently on the network, in the registry and in Kerberos. This guide compares every type, explains how the Service Control Manager stores and uses service credentials, sets out how to choose and harden them, and covers the detection events and metrics that show the estate is under control. It is written for Windows server engineers, Active Directory administrators and identity teams. Group managed service accounts and dMSA internals are covered in depth in the Group Managed Service Accounts (gMSA) Guide; this page covers the wider service estate around them.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • The account is the blast radius. A service running as LocalSystem holds SeDebugPrivilege, SeImpersonatePrivilege and SeTcbPrivilege and can open HKLM\SECURITY, so any flaw in that service is a full host compromise.
  • Passwords for user-account services live in LSA secrets. Anyone with SYSTEM on the host can recover them, which is why one domain service account reused across many servers turns a single compromise into lateral movement.
  • Prefer managed identities in a fixed order. Virtual accounts or LocalService for local-only services, gMSA for anything that needs a domain identity, dMSA on Windows Server 2025 to retire legacy accounts, and domain user accounts only as a documented exception.
  • Service configuration is part of identity security. Unquoted service paths, writable service binaries and weak service registry ACLs let a low-privileged user run code as the service account.
  • Watch who can create services and managed accounts. Event 4697 and 7045 catch new services, and auditing dMSA creation (event 5137) and link changes (event 5136) catches BadSuccessor-style abuse.

Windows service identities compared

A service's account is stored in the ObjectName value under HKLM\SYSTEM\CurrentControlSet\Services\<ServiceName>. When the service starts, the Service Control Manager logs on as that account and attaches the resulting token to the service process, so the account decides what the process can touch locally and how it authenticates on the network.

IdentityLocal privilegeNetwork identityPasswordTypical use
LocalSystem (NT AUTHORITY\SYSTEM)Highest: Administrators group SID, SeDebug, SeTcb, SeImpersonate, access to HKLM\SECURITYComputer account (DOMAIN\HOST$)NoneCore OS services only; default when no account is given
LocalService (NT AUTHORITY\LOCAL SERVICE)LowAnonymousNoneServices that never need network authentication
NetworkService (NT AUTHORITY\NETWORK SERVICE)LowComputer accountNoneLow-privilege services that need to authenticate as the host
Virtual account (NT SERVICE\<ServiceName>)Low, with its own service SID for ACLsComputer accountNone, managed by WindowsPer-service isolation on one host, such as SQL Server and IIS application pools
Local user account (.\svc-name)As grantedNone (anonymous only)Static, manualLegacy; rarely appropriate
Domain user accountAs granted, often far too muchIts own domain identity with KerberosStatic, manual, stored in LSA secretsLegacy applications that cannot use managed accounts
Standalone MSA (sMSA)As grantedIts own domain identityManaged, one host onlySingle-server services needing a distinct domain identity
Group MSA (gMSA)As grantedIts own domain identityComputed by DCs, rotated every 30 days by default, readable by allowed hostsFarms, clusters, load-balanced services, scheduled tasks
Delegated MSA (dMSA)As grantedIts own domain identity bound to specific machinesRandomised, derived from the machine account, held only by DCsWindows Server 2025 replacement for legacy domain user service accounts

Two points from the table matter most. First, NetworkService, virtual accounts and LocalSystem all appear on the network as the computer account, so you cannot tell which service on a host made a change; that limits per-service auditing. Second, only the managed account types remove the static password, and only dMSA keeps the secret off the host entirely.

How Windows stores and uses service credentials

  • LSA secrets: when a service is configured to run as a local or domain user, Windows keeps the password so the SCM can log on at start-up. MITRE ATT&CK T1003.004 LSA Secrets describes how an attacker with SYSTEM can read these from HKEY_LOCAL_MACHINE\SECURITY\Policy\Secrets or from memory. Every server that runs the service holds a recoverable copy of the password.
  • The logon right: SeServiceLogonRight (Log on as a service, under Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment) controls which accounts can register a process as a service. Deny log on as a service overrides it. Microsoft's guidance is to keep the list short.
  • Logon type: services log on with logon type 5 in event 4624, which makes interactive (type 2) or RemoteInteractive (type 10) logons by a service account a clear anomaly.
  • Service SIDs: every service has a per-service SID (NT SERVICE\<name>). Setting the SID type to restricted (sc.exe sidtype <name> restricted) produces a write-restricted token, so the service can only write where its service SID is explicitly granted. sc.exe privs limits the token to the privileges the service actually needs.
  • Service DACLs: each service object has its own access control list deciding who can start, stop or reconfigure it. A user who can change a service's binary path or account can make it run anything as that identity.
  • Kerberos: any domain user account with a servicePrincipalName can be targeted by Kerberoasting (T1558.003), because any authenticated user can request a ticket encrypted with a key derived from its password. Managed accounts defeat this with long random passwords. See the Kerberoasting and AS-REP Roasting Defence Guide.

Choosing the right account

Microsoft's on-premises service account guidance recommends testing managed accounts first and working down: gMSA, then sMSA, then a computer account, then a user account. Windows Server 2025 adds dMSA for high-security cases and for replacing existing user-based service accounts.

SituationChooseWhy, and the trade-off
Service needs no network accessVirtual account or LocalServiceNo password and low privilege; check the vendor supports it
Service on one host needs to reach a file share or SQL as the hostVirtual account or NetworkServiceSimple, but every service on the host shares the computer account's network rights
Service on one host needs its own domain identitygMSA (or sMSA)Distinct identity for auditing and ACLs; gMSA is preferred even for one host
Farm, cluster or load-balanced servicegMSAShared identity across nodes; protect the password retrieval group
Legacy domain user service account on Windows Server 2025 hostsdMSA migrationRemoves the static password and binds use to listed machines; all hosts using it must support dMSA
Application insists on a user name and passwordDomain user account as a documented exceptionStatic secret in LSA secrets; compensate with controls below and a vault
Service genuinely needs kernel-level or full local rightsLocalSystemOnly for vendor-mandated services; harden the binary path and DACL
  • Small organisations: start by moving every custom service off LocalSystem and off any account in Domain Admins, then convert the handful of shared domain service accounts to gMSA. One KDS root key and a simple naming convention (svc- or gmsa- prefixes) are enough.
  • Large organisations: run a programme: inventory by host and service, tier each account (an account that runs on a Tier 0 system is Tier 0), migrate in waves by application owner, and track exceptions with expiry dates. Plan dMSA only where Windows Server 2025 DCs and hosts are in place. The Tiered Administration and Enterprise Access Model Guide covers the tiering rules.

Hardening service accounts and service configuration

For any domain user account that must remain

  • Remove privileged group membership: service accounts should not be in Domain Admins, Enterprise Admins, Administrators on DCs, or any group that grants control of Tier 0. Microsoft's guidance is explicit that service accounts should not belong to privileged groups and that each service should have its own account.
  • Block interactive use: grant Deny log on locally and Deny log on through Remote Desktop Services to a service accounts group through Group Policy, and restrict where the account can log on (the LogonWorkstations attribute) where the application allows it.
  • Stop delegation and weak crypto: set "Account is sensitive and cannot be delegated" unless delegation is a documented requirement, set msDS-SupportedEncryptionTypes to AES only, and use a random password of at least 25 characters held in a vault. See the Kerberos Delegation Security Guide.
  • Record an owner: Microsoft recommends documenting owner, purpose, permission scope, risk profile and an attestation cycle for each service account, with the owner in the description attribute.

For the service itself

  • Quote binary paths: any ImagePath with spaces must be quoted, or a writable parent folder lets an attacker plant an executable that runs as the service account (T1574.009 Path Interception by Unquoted Path).
  • Lock binaries and registry keys: service executables and their folders should be writable only by Administrators and TrustedInstaller, and the service's registry key only by Administrators and SYSTEM (T1574.010 and T1574.011).
  • Restrict the token: use restricted service SIDs and required privileges for in-house services, and grant file and registry access to NT SERVICE\<name> rather than to a shared account.
  • Protect the hosts: enable Credential Guard where supported and run EDR protection for LSASS, because SYSTEM on the host defeats every password-based option. Use Windows LAPS for local administrator passwords. See the Local Administrator Password Solution (LAPS) Guide.

dMSA and BadSuccessor in brief

A dMSA migration links an existing service account to a new dMSA. Start-ADServiceAccountMigration sets msDS-ManagedAccountPrecededByLink and msDS-DelegatedMSAState = 1; Complete-ADServiceAccountMigration copies SPNs, delegation settings and authentication policy membership to the dMSA, sets the state to 2 and disables the old account. Microsoft recommends waiting at least two ticket lifetimes (14 days) before completing and keeping the start state for four (28 days). Plan MSA and gMSA moves separately, as Microsoft describes migration from standard service accounts, and replace unconstrained delegation first, as it stops working after migration.

The BadSuccessor technique relates to how msDS-ManagedAccountPrecededByLink decides which account's privileges a dMSA inherits, so the right to create a dMSA in an OU is a privileged right once a Windows Server 2025 DC exists. Apply Microsoft's security updates promptly; see the Microsoft Security Update Guide. Regardless of patch level, restrict who can create msDS-DelegatedManagedServiceAccount objects, and audit OU CreateChild rights. The gMSA guide covers the full attack and Golden dMSA; the Active Directory ACL and Delegation Hygiene Guide covers OU permission clean-up.

Migrating a service estate

  1. Inventory: collect every service and scheduled task with its StartName (for example Get-CimInstance Win32_Service on each server, or from EDR or configuration management), plus AD queries for user accounts with servicePrincipalName set, PasswordNeverExpires, and delegation flags. Join them so each account maps to hosts and services.
  2. Triage: flag accounts in privileged groups, accounts used on more than one tier, accounts with RC4-only encryption, and custom services running as LocalSystem.
  3. Prepare the forest: create the KDS root key (for gMSA), a security group per application for password retrieval, and audit SACLs for service account OUs.
  4. Pilot: convert one low-risk application in a test environment, confirm the service starts, reaches its back ends and survives a password rotation, then repeat in production for a pilot ring of servers.
  5. Cut over in waves: change the service logon to the managed account (the account name ends in $ and the password is left blank), keep the old account enabled but unused for a defined period, and watch for 4625 failures and Kerberos errors.
  6. Roll back if needed: revert the service logon to the old account, which is why you do not disable or reset it until the observation period ends. For dMSA, roll back before running Complete-ADServiceAccountMigration, following Microsoft's dMSA setup article.
  7. Retire: disable, then delete, the old account after its last logon is older than the observation period, and remove its SPNs.

Detection and measurement

EventLogWhy it matters
4697 A service was installed in the systemSecurity (Audit Security System Extension)Records service name, file name, start type and account; alert on paths outside %windir% and Program Files and on accounts other than LocalSystem, LocalService or NetworkService
7045 A service was installedSystemSame signal without extra auditing; useful on hosts where 4697 is not enabled
4624 logon type 2 or 10 by a service accountSecurityService accounts should only log on as type 5 (service) or type 3 (network)
4769 with ticket encryption 0x17 (RC4)Security on DCsService tickets for user-based accounts in RC4, a Kerberoasting signal
4738 and 4728/4732/4756Security on DCsService account changes and additions to privileged groups
5137 and 5136 on dMSA objectsSecurity on DCs (with SACLs)dMSA creation and changes to msDS-ManagedAccountPrecededByLink
2946Directory ServiceUnexpected dMSA key retrieval events, worth investigating

Event 4697 only captures the binary path and account at creation, so pair it with process creation logging and configuration drift checks. The Active Directory Security Monitoring and Event IDs Guide covers DC-side collection.

Metrics

  • Managed coverage: percentage of services needing a domain identity that run as gMSA or dMSA (target above 90% for in-house services).
  • Privileged service accounts: number of service accounts in Tier 0 groups (target zero, with named exceptions).
  • Kerberoastable accounts: user accounts with SPNs and passwords older than one year, trending to zero.
  • Custom services as LocalSystem: count of non-Microsoft services running as LocalSystem, reviewed quarterly.
  • Configuration weaknesses: unquoted paths and writable service binaries found by scanning, with time to fix.
  • Ownership: share of service accounts with a named owner and an attestation in the last 12 months.

Common failure patterns

  • One account everywhere: a single domain service account runs backup, monitoring and deployment agents on hundreds of servers. One compromised server yields the password from LSA secrets and access to all the others.
  • Service accounts in Domain Admins: added years ago to make an installer work and never removed, giving any member server running the service a path to the domain.
  • Sync and management servers not treated as Tier 0: the Entra Connect Sync service account credentials on a sync server can be used to change cloud identities. A service account is as sensitive as the system it can change.
  • gMSA retrieval open to too many: PrincipalsAllowedToRetrieveManagedPassword set to a broad group or to Domain Computers, so any member computer can read the password.
  • OU create rights left wide open: help desk or application teams with CreateChild on OUs, which became a domain escalation path with BadSuccessor.
  • Vendor defaults accepted: third-party installers that register services as LocalSystem with unquoted paths in writable folders.

Framework mapping

Control areaNIST SP 800-53 Rev. 5NIST CSF 2.0MITRE ATT&CK
Service account inventory, ownership and lifecycleAC-2PR.AA-01T1078.002 Domain Accounts
Least privilege accounts and tokensAC-6PR.AA-05T1543.003 Windows Service
Managed passwords, AES, no static secretsIA-5PR.AA-01T1558.003 Kerberoasting, T1003.004 LSA Secrets
Service authenticationIA-9PR.AA-03T1558 Steal or Forge Kerberos Tickets
Service configuration and permissionsCM-6, CM-7PR.PS-01T1574.009, T1574.010, T1574.011
Monitoring service installs and account changesAU-2, AU-6DE.CM-03T1569.002 Service Execution, T1098 Account Manipulation

In CIS Controls v8.1, Safeguard 5.5 (establish and maintain an inventory of service accounts) and Control 6 apply; in ISO/IEC 27001:2022 Annex A, A.5.16 identity management, A.5.18 access rights and A.8.2 privileged access rights.

Practitioner checklist

  • Inventory every service and scheduled task with its run-as account on every Windows server, and map accounts to owners.
  • Move custom services off LocalSystem to virtual accounts, LocalService or NetworkService where they need no domain identity.
  • Convert domain user service accounts to gMSA, or dMSA where Windows Server 2025 is in place, starting with those on Tier 0 systems.
  • Remove service accounts from privileged groups and deny interactive and RDP logon for the rest.
  • Set AES-only encryption and 25-plus character vaulted passwords for any user-based service account that remains.
  • Scan for unquoted service paths, writable service binaries and weak service registry ACLs and fix them.
  • Restrict who can create dMSAs and review CreateChild rights on OUs.
  • Alert on 4697 and 7045 with unusual paths or accounts, and on interactive logons by service accounts.
  • Review gMSA password retrieval groups quarterly.

Standards and references

Related NHI Mgmt Group resources: Group Managed Service Accounts (gMSA) Guide · Active Directory and Entra ID Hardening Guide · Service Account Security Guide · Service Account Inventory Template

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.