Join our Newsletter — 33% off our NHI Course
Home› Guides› How to find what is locking out a…
Guide Non-Human Identity (NHI)

How to find what is locking out a service account: Trace 4740 and 4771 back to the stale credential

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 15 November 2026 13 min read
On this page

A service account that keeps locking out after a password change is almost always being fed its old password by something you forgot: a Windows service, a scheduled task, a mapped drive, an application config file or a cached session on another server. Each lockout stops the services that depend on the account, and the usual reaction, raising the lockout threshold or exempting the account, hides the stale credential and weakens brute-force protection for good. This guide shows how to trace a lockout from event 4740 on the domain controllers to the calling computer, then from events 4625, 4771 and 4776 to the process or task holding the old password, how to fix it without a repeat, and how to stop it happening again by moving to group managed service accounts. It is for Active Directory administrators, server owners and SOC analysts. Lockout policy itself is covered in the Account Lockout and Brute-Force Protection Guide.

Key takeaways

  • Start at the domain controllers, end on the caller: event 4740 names the locked account and the Caller Computer Name. That computer, not the domain controller, holds the stale credential.
  • Use the failure events to find the process: on the caller, 4625 carries the Logon Type and Caller Process Name; on domain controllers, 4771 (Kerberos, failure code 0x18) and 4776 (NTLM, 0xC000006A) carry the client address or source workstation.
  • The logon type tells you where to look: type 5 is a Windows service, type 4 a scheduled task or batch job, type 3 a network connection such as a mapped drive or an application on another host.
  • Fix every copy before you unlock: unlock first and the account locks again within minutes. Update or remove each stored credential, then unlock, then watch for 24 hours.
  • gMSA removes the cause: with a group managed service account, Windows manages the password and authorised hosts retrieve it from a domain controller, so there is no copy to go stale.

Why service accounts lock out

Microsoft's troubleshooting guidance for managed domains lists the usual causes, and they apply to any Active Directory forest: an application or service still using an old password, a password change that has not yet reached every system, and people retrying an old password. Microsoft's account lockout threshold documentation adds two that catch service accounts in particular: applications that retry after dropped connections, where every failed retry counts towards the threshold, and Kerberos retries during encryption type negotiation, which also count.

Where the old password livesTypical logon type in 4625Clue
Windows service "Log On As" account5 (Service)Lockout at boot or service restart; Caller Process Name is services.exe
Scheduled task stored credentials4 (Batch)Lockouts at a fixed time each hour, night or week
IIS application pool identity4 or 5, depending on configurationLockouts on recycle or first request after idle
Mapped drive or saved credential on another computer3 (Network) at the file serverCaller is a workstation or jump host, often at user logon
Application config file, connection string or script3 (Network), or Kerberos 4771 at the DCCaller is an application server; repeats on the application's retry interval
Disconnected Remote Desktop session still running as the accountVariesCaller is a server the account should not sign in to interactively
Device or appliance (scanner, NAS, load balancer) using LDAP or SMB bind3 (Network), or via a relay such as RADIUSCaller is a non-Windows host, or the source field is empty

A copy that is not on the list is a finding in itself: if the account is used somewhere nobody documented, the inventory is wrong. See How to Find credentials in cron jobs and scheduled tasks.

The events you need

EventLogged onAudit subcategoryField that points at the source
4740 A user account was locked outDomain controllers (and member servers and workstations for local accounts)Audit User Account ManagementCaller Computer Name
4771 Kerberos pre-authentication failedDomain controllers onlyAudit Kerberos Authentication ServiceClient Address; Failure Code 0x18 means wrong password, 0x17 expired password
4776 The computer attempted to validate the credentials for an account (NTLM)The domain controller for domain accountsAudit Credential ValidationSource Workstation; Error Code 0xC000006A bad password, 0xC0000234 locked
4625 An account failed to log onThe computer where the logon was attemptedAudit LogonLogon Type, Caller Process Name, Workstation Name, Source Network Address; Status 0xC000006A or 0xC0000234

Two field quirks matter. Microsoft notes that the 4740 Caller Computer Name is a computer name even when the caller is outside the domain, never an IP address. And Microsoft's lockout guidance for managed domains notes that the Source Workstation field can be empty when the attempt is relayed through another device such as a RADIUS server; in that case look for the relaying device in the logon record. The logon type values are explained in the Windows Logon Types and Authentication Events guide.

Step 1: confirm the lockout and find the caller

  1. Check auditing: confirm Audit User Account Management, Audit Kerberos Authentication Service and Audit Credential Validation are enabled for success and failure on domain controllers, and Audit Logon failure on member servers. Events are only captured from the time auditing is on.
  2. Search every domain controller, starting with the PDC emulator: in Active Directory, bad password attempts are checked against the PDC emulator, and the lockout is normally recorded there, so it is the fastest place to start. In a SIEM, search all domain controllers for 4740 with the locked account's SID.
  3. List every Caller Computer Name: one caller usually means one stale copy; several callers mean the account is used in several places, and each needs fixing.
  4. Note the time pattern: lockouts on the hour point at a scheduled task; lockouts at boot point at a service; lockouts every few minutes point at an application retry loop.

A starting query for Microsoft Sentinel with Windows Security events, replacing the account name:

1 Sample only, based on the public documentation cited. Assess it independently against the current official documentation, test outside production and back up first.

Sample 1
SecurityEvent
| where TimeGenerated > ago(7d)
| where EventID in (4740, 4771, 4776, 4625)
| where TargetUserName =~ "svc-app01"
| extend Source = coalesce(TargetDomainName, IpAddress, WorkstationName)
| summarize Events = count(), First = min(TimeGenerated), Last = max(TimeGenerated)
    by EventID, Computer, Source, LogonType, Status, FailureReason
| order by Last desc

Field mapping differs between event IDs and connectors (for 4740 the Caller Computer Name is commonly carried in TargetDomainName in SecurityEvent), so check the raw event in your workspace before trusting the Source column.

Step 2: find the process on the caller

  1. Read 4625 on the calling computer: filter on the account. Logon Type and Caller Process Name usually name the culprit directly: services.exe for a service, taskeng.exe or svchost.exe hosting the Task Scheduler for a task, w3wp.exe for an IIS application pool, or an application's own executable.
  2. If the caller is a domain controller or relay: use the Client Address in 4771 or the Source Workstation in 4776 to move one hop further out.
  3. List configured credentials on the caller: services whose Log On As account is the service account, scheduled tasks that run as it, IIS application pool identities, saved credentials in Credential Manager for any user profile that uses the account, and persistent mapped drives. Check config files and connection strings for the account name.
  4. If the logs still do not name it: enable Netlogon debug logging on a domain controller with Nltest /DBFlag:2080FFFF. Microsoft documents that it writes to %windir%\debug\netlogon.log, rolls over to Netlogon.bak at 20 MB by default, and is turned off with Nltest /DBFlag:0x0. Turn it off when finished.
  5. Non-Windows callers: appliances, Linux hosts using Kerberos keytabs and SaaS connectors using LDAP binds show as a network address only. Check the device's own configuration and its owner. For keytabs, see the Linux Service Accounts and Keytab Management Guide.

Step 3: fix it without a repeat lockout

  1. Collect every copy first: from steps 1 and 2, list each caller and each stored location. Agree a change window with the owners of those systems.
  2. Update the credential everywhere: set the current password on each service, task, application pool and config entry, or remove the entry if the account should not be used there.
  3. Restart what needs it: a Windows service reads its credential at start, so update and then restart it. Clear stale saved credentials and disconnect leftover sessions.
  4. Unlock the account: only now. Unlocking earlier just starts the next lockout.
  5. Watch for 24 hours: keep the step 1 query running for at least one full cycle of daily and weekly jobs. A new 4740 means a copy was missed.
  6. Rollback: if a dependent system breaks and you cannot find the copy in time, set the account's old password back only as a short, recorded exception, and keep tracing. Do not disable lockout for the account.

The full rotation sequence, including order of operations across hosts, is in Rotating a Windows or Linux Service Account Password.

Decision guidance: fix in place or replace the account

SituationRecommended actionWhy
Windows services, scheduled tasks or IIS application pools on Windows Server 2012 or laterConvert to a gMSAWindows manages the password and hosts retrieve the current and preceding password from a domain controller
Application that only accepts a username and password in its configFix in place, then move the secret to a vault the application reads at startOne copy to update, with an audit trail of reads
Account used by many unrelated systemsSplit into one account per systemEach lockout then affects one service, and each owner rotates their own
Device or appliance that cannot use gMSADedicated account, documented location, rotation tied to the device's change processThe stale copy is known in advance
Lockouts with no matching configuration, from unexpected callersTreat as possible password guessingA caller you cannot explain is a security incident until proven otherwise

Small estates with a handful of service accounts can fix in place and document; large estates with hundreds should treat repeated lockouts as the trigger to convert. Microsoft notes that gMSAs need hosts on Windows Server 2012 or later and recommends AES for managed service accounts, because authentication fails on hosts that do not support the encryption type chosen. See How to convert AD service accounts to gMSA and the Group Managed Service Accounts (gMSA) Guide.

When a lockout is an attack, not a stale password

Some lockouts are not configuration drift. Microsoft's monitoring guidance for 4740 recommends alerting when a high-value account locks out, when the caller is a host the account should never authenticate from, and when the Caller Computer Name is not from your domain. For 4771 it recommends alerting on bursts of failure code 0x18 and on client addresses outside your internal ranges. Signs that you are looking at password guessing rather than a forgotten task: callers that do not appear in the account's documented host list, many accounts locking from the same caller, 4625 with Status 0xC0000064 (unknown user) alongside the lockouts, and failures from Caller Process Names outside System32 or Program Files. Escalate to the SOC and follow the Password Spraying Attack Response Playbook.

Detection and measurement

  • Alert: any 4740 for an account on the service account watchlist, with the Caller Computer Name compared with the account's documented hosts.
  • Alert: 4625 with Status 0xC000006A for a service account from a host where it is not documented.
  • Report: weekly list of service accounts with any bad-password failures, which exposes stale copies before they reach the threshold.

Metrics that show the problem is shrinking:

  • Service account lockouts per month, trending down.
  • Mean time from lockout to root cause identified.
  • Share of password rotations completed with no lockout in the following week.
  • Share of service accounts converted to gMSA or another managed identity.
  • Service accounts with a complete, current list of hosts and stored locations.

Common failure patterns

  • Raising the threshold or exempting the account: Microsoft's own guidance for managed domains says not to raise the threshold to hide the problem. It leaves the stale copy in place and removes protection from a high-value account.
  • Unlocking before fixing: the account locks again before the ticket is closed, and the cycle repeats every rotation.
  • Searching one domain controller: a 4740 on another domain controller, or the 4771 with the client address, is missed.
  • Fixing one copy: several callers mean several copies. One fix and a quiet hour is not proof.
  • Shared accounts across systems: no single owner knows every location, so every rotation becomes an outage hunt.
  • Ignoring the security angle: an unexplained caller is written off as "another stale task" when it is someone guessing the password.

Framework mapping

FrameworkReferenceRelevance
MITRE ATT&CK mitigationsM1036 Account Use Policies; M1027 Password PoliciesLockout thresholds and password management for accounts
MITRE ATT&CKT1110 Brute Force; T1078.002 Valid Accounts: Domain AccountsWhat an unexplained lockout may indicate
NIST SP 800-53 Rev 5AC-7 Unsuccessful Logon Attempts; AC-2 Account Management; IA-5 Authenticator ManagementLockout, account ownership and password rotation
NIST CSF 2.0PR.AA-01; DE.CM-03Managed identities and credentials; monitoring account activity
CIS Controls v8.1Safeguard 5.5 Establish and Maintain an Inventory of Service Accounts; Control 8 Audit Log ManagementKnowing where each account is used, and logging failures
ISO/IEC 27001:2022 Annex AA.5.17 Authentication information; A.8.15 LoggingManaging stored passwords and recording failures

See M1036 Account Use Policies for the mitigation in full.

Practitioner checklist

  • Enable Audit User Account Management, Kerberos Authentication Service and Credential Validation on all domain controllers, and Audit Logon failure on servers.
  • Search all domain controllers for 4740 by account SID and list every Caller Computer Name.
  • On each caller, read 4625 Logon Type and Caller Process Name to find the service, task or application.
  • Use 4771 Client Address and 4776 Source Workstation when the caller is a relay or domain controller.
  • Enable Netlogon debug logging only when needed, and turn it off afterwards.
  • Update every stored copy, restart dependants, then unlock and watch for 24 hours.
  • Record each location in the service account inventory with an owner.
  • Convert eligible services, tasks and application pools to gMSA.
  • Alert on service account lockouts from undocumented callers and treat them as possible attacks.

Standards and references

Related NHI Mgmt Group resources: Service Account Security Guide · How to build a service account inventory from Active Directory · Kerberos Error Codes Troubleshooting Guide · How to Detect Service Account Misuse · Top 10 Service Account Mistakes

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.

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 both boxes to continue.