Find the source of an account lockout

Drop a domain controller's Security log and see, for every locked account, the computer each lockout came from (event 4740's Caller Computer Name) and the addresses and workstations behind its bad passwords (events 4625, 4771 and 4776). The file is read in this browser tab and never uploaded.

Or paste events (XML, a CSV export or text copied from Event Viewer)

1. Get the log from the right domain controller

Microsoft: "From Windows Server 2008 onwards, an account lockout event will register on the PDCe as event ID 4740 - 'a user account was locked out' - with the lockout source included" (Tracing the Source of Account Lockouts). Find the PDC emulator, then export only the events this needs, which keeps the file small:

# Which domain controller is the PDC emulator
Get-ADDomainController -Discover -Service PrimaryDC

# On that domain controller (administrator command prompt)
wevtutil epl Security C:\temp\lockouts.evtx /q:"*[System[(EventID=4740 or EventID=4625 or EventID=4771 or EventID=4776)]]"

Bad-password events are logged where the password was checked: 4771 (Kerberos) and 4776 (NTLM) on the domain controller that answered, and 4625 on the computer where the logon failed. If the lockout events name no caller computer, export the same events from the other domain controllers too.

2. Read the Caller Computer Name

In event 4740 the Caller Computer Name is stored in the TargetDomainName field of the XML, and Microsoft defines it as "the name of computer account from which logon attempt was received and after which target account was locked out" (event 4740 documentation). The finder groups the lockouts of each account by that name. To check one account without the file, Microsoft's own PowerShell for the last hour:

$User = 'jsmith'
$PDC = Get-ADDomainController -Discover -Service PrimaryDC
Get-WinEvent -ComputerName $PDC.Name -LogName Security -FilterXPath "*[System[EventID=4740 and TimeCreated[timediff(@SystemTime) <= 3600000]] and EventData[Data[@Name='TargetUserName']='$User']]" |
  Select-Object TimeCreated, @{n='User';e={$_.Properties[0].Value}}, @{n='Caller computer';e={$_.Properties[1].Value}}

In Microsoft Sentinel, where the same field is the TargetDomainName column:

SecurityEvent
| where EventID == 4740
| summarize Lockouts = count(), First = min(TimeGenerated), Last = max(TimeGenerated)
    by Account = TargetUserName, CallerComputer = TargetDomainName
| order by Lockouts desc

3. Match the bad passwords

The Caller Computer Name says where the last attempt came from; the failures before it say how. The finder counts, per account and source, 0xC000006A (wrong password) in 4625 and 4776, 0x18 (pre-authentication failed) in 4771, and attempts made after the lockout (0xC0000234, account locked out). The 4771 shows an address and the 4776 a workstation name, so the same computer can appear twice: once by name, once by address.

4. Find what on that computer holds the old password

Microsoft's advice once the source host is known: "look for stale RDP sessions, mapped drives, schedules tasks, etc." The usual suspects are a mapped drive or a scheduled task saved with the old password, a service running as the account, a Credential Manager entry, a disconnected RDP session, and phones or mail clients still signing in with the old password. On the source computer, its own 4625 events name the logon type and the process that tried.

# On the source computer: services and scheduled tasks that run as the account
Get-CimInstance Win32_Service | Where-Object StartName -like '*jsmith*' | Select-Object Name, StartName, State
Get-ScheduledTask | Where-Object { $_.Principal.UserId -like '*jsmith*' } | Select-Object TaskName, TaskPath
cmdkey /list

If many accounts lock out at once, or the bad passwords come from many addresses or from outside, treat it as password guessing rather than a stale password: the log analyzer flags password spraying and brute force in the same file.

Questions

Which event ID shows the source of an account lockout?
Event 4740, "A user account was locked out". Its Caller Computer Name (the TargetDomainName field in the XML) is, in Microsoft’s words, "the name of computer account from which logon attempt was received and after which target account was locked out". It is logged on the domain controllers; Microsoft points to the PDC emulator as the place to collect it.
Why is the Caller Computer Name empty?
The 4740 then cannot say where the attempts came from. Use the failures that led up to it instead: 4771 with failure code 0x18 (Kerberos, with the client address) and 4776 with 0xC000006A (NTLM, with the workstation name) on the domain controllers, and 4625 on the computer where the logon failed. This tool lists the sources of those events for each account.
I found the computer. What on it is using the old password?
Look for a saved credential that still holds the old password: a mapped drive, a service or scheduled task running as the account, Credential Manager entries, a disconnected RDP session, a phone or mail client signing in with the old password. 4625 events on that computer show the logon type (3 for a network logon such as a mapped drive, 10 for RDP) and the process that made the attempt.
Can a lockout be an attack rather than a stale password?
Yes. Several accounts locking out together, a caller computer you do not recognise, or bad passwords from many addresses point to password guessing. Microsoft recommends alerting on 4740 when the caller computer should not be using the account, and when it is not from your domain.
Do I need to upload the log?
No. The file is read by JavaScript in your browser tab; nothing is sent to LogTriage or anyone else. Binary .evtx files, Event Viewer’s "Save as XML" and "Save as CSV" exports, PowerShell’s Get-WinEvent | Export-Csv and copied event text all work, also gzipped.

Lockouts across many accounts?

That is what password spraying looks like. The free analyzer reads the same Security log and flags spraying, brute force and the logon that succeeded afterwards.

Investigating something right now? LogTriage checks every address in the file against threat intelligence and writes the incident report: 10 analyses a month free. The incident pack adds the in-depth AI analysis and files up to 100 MB: 25 analyses for $19, one payment, no subscription. Pricing

Every query on this site's reference pages, the Sigma rules and a cheat sheet in one download: the Incident Response Kit, $29 once.