Find what keeps locking out an Active Directory account: read Event ID 4740 on the PDC emulator with Get-WinEvent, take the Caller Computer Name, then check 4625 on that computer and 4771 or 4776 on the domain controllers.
Home › Guides › Account lockout source (4740)
Last updated 18 November 2026
(Get-ADDomain).PDCEmulator.Look up any other ID you meet along the way in the Windows Event ID Lookup.
Microsoft's Active Directory technical specification ([MS-ADTS] 6.1.5.4, PDC Emulator FSMO Role) lists what the PDC emulator does:
There is one PDC emulator per domain. Its name is in the PDCEmulator property that Get-ADDomain returns (Microsoft's example output shows PDCEmulator : User04-DC1.User04.com). The 4740 event itself is generated for user accounts on domain controllers, member servers and workstations, and it belongs to the Audit User Account Management audit subcategory, so that subcategory has to be audited on the DCs for the event to appear.
With the Active Directory module (RSAT), Microsoft's example lists every locked-out account:
Search-ADAccount -LockedOut | FT Name,ObjectClass -A
Unlock one by SAM account name or distinguished name once you have found the cause (unlocking first just lets the source lock it again):
Unlock-ADAccount -Identity PattiFu
$pdc = (Get-ADDomain).PDCEmulator
Get-WinEvent -ComputerName $pdc -FilterHashtable @{
LogName = 'Security'
Id = 4740
StartTime = (Get-Date).AddDays(-1)
} | ForEach-Object {
$d = @{}
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]@{
Time = $_.TimeCreated
User = $d.TargetUserName
CallerComputer = $d.TargetDomainName
}
}
TargetUserName and the caller computer (WIN81, the same example Microsoft gives for Caller Computer Name) is in the TargetDomainName data field. Event Viewer shows that field as Caller Computer Name.-ComputerName takes one computer at a time and doesn't use PowerShell remoting, but the firewall must allow remote access to the event log service. Otherwise run the query on the PDC emulator itself.ToXml() returns the event as XML with all of its properties, which is the easiest way to read the named fields.@{LogName='Security'; Id=4740; TargetUserName='jdoe'}. Microsoft notes this <named-data> key was added in PowerShell 6, so in Windows PowerShell 5.1 filter with Where-Object after the query instead.Microsoft also points out that a computer outside your domain still shows up as a computer name rather than an IP address in 4740.
Run the same kind of query on the computer named in Caller Computer Name. 4625 is logged in the Audit Logon and Audit Account Lockout subcategories:
Get-WinEvent -ComputerName WIN81 -FilterHashtable @{LogName='Security'; Id=4625; StartTime=(Get-Date).AddDays(-1)} |
ForEach-Object {
$d = @{}
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]@{ Time=$_.TimeCreated; User=$d.TargetUserName; Status=$d.Status; SubStatus=$d.SubStatus
LogonType=$d.LogonType; Process=$d.ProcessName; SourceIP=$d.IpAddress; Workstation=$d.WorkstationName }
} | Where-Object User -eq 'jdoe'
What to read in each event:
| Field (XML name) | What it tells you |
|---|---|
Caller Process Name (ProcessName) | Full path of the executable that attempted the logon. |
Logon Type (LogonType) | 2 interactive, 3 network, 4 batch (processes running for a user without direct intervention), 5 service (started by the Service Control Manager), 7 unlock, 8 network cleartext, 9 new credentials, 10 remote interactive (Remote Desktop), 11 cached interactive. |
Source Network Address (IpAddress) | IP address of the machine the attempt came from. ::1 or 127.0.0.1 means the local computer. |
Workstation Name (WorkstationName) | Machine name the attempt was performed from. |
| Status / Sub Status | Why it failed, for example 0xC000006A (bad password) or 0xC0000234 (account locked out). The full list is in 4625 status and sub status codes. |
Logon type 5 means a service started by the Service Control Manager is using the account, and type 4 a batch process running on the user's behalf without their direct intervention; either way, look for a stored copy of the old password. Type 3 with a remote Source Network Address means the attempts come from another machine, so repeat the step there. Check who owns an unfamiliar public address with the ASN IP Lookup or Cloud IP Lookup, and whether an internal one is in your server ranges with the IPv4 Subnet Calculator.
Microsoft also notes that failed attempts to unlock a workstation can lock the account even when Interactive logon: Require Domain Controller authentication to unlock workstation is disabled: entering a password different from the one you logged on with makes Windows contact a domain controller in case the password was changed on another machine.
If the Caller Computer Name is a server that authenticates users on their behalf, the original client is in the domain controller logs:
0x18 (KDC_ERR_PREAUTH_FAILED) means the wrong password was provided; 0x17 (KDC_ERR_KEY_EXPIRED) means the password has expired. 4771 isn't generated for accounts set to Do not require Kerberos preauthentication.0xC000006A is a bad password and 0xC0000234 is an account that is already locked.Because a DC forwards bad-password attempts to the PDC emulator, query each DC as well as the PDC emulator when you are looking for 4771 and 4776 events.
The three settings are under Computer Configuration\Windows Settings\Security Settings\Account Policies\Account Lockout Policy:
| Setting | Values | Notes from Microsoft |
|---|---|---|
| Account lockout threshold | 0 to 999 failed sign-ins; 0 means never lock | Default domain policy is 0. Windows security baselines suggest 10 as an acceptable starting point. |
| Account lockout duration | 0 to 99,999 minutes; 0 means locked until an administrator unlocks it | Must be greater than or equal to the reset counter value when the threshold is above 0. Microsoft calls about 15 minutes advisable. |
| Reset account lockout counter after | 1 to 99,999 minutes | Time after a failed sign-in before the counter goes back to 0. Windows security baselines recommend 15. |
Microsoft warns that any threshold above 0 also lets an attacker who knows account names lock them out with nothing more than network access, so a sudden wave of 4740 events across many accounts deserves a security review rather than a round of unlocks.
Look up any event ID in the Windows Event ID Lookup, keep these cmdlets in the PowerShell Cheat Sheet, check who owns a source IP with the ASN IP Lookup and Cloud IP Lookup, test whether it is inside your ranges with the IPv4 Subnet Calculator or IPv6 Subnet Calculator, and generate a strong new password for a service account with the UUID / Password Generator. Related guides: Event ID 4625 status and sub status codes and the trust relationship between this workstation and the primary domain failed.
In the Security log. For domain accounts read it on the PDC emulator, because Microsoft's Active Directory specification says account lockout is processed there. The event can also be generated on other domain controllers, member servers and workstations.
It is the computer the logon attempt was received from, after which the account was locked out. In the event XML that value is stored in the TargetDomainName data field. Microsoft notes a computer outside your domain still appears as a name, not an IP address.
Run (Get-ADDomain).PDCEmulator with the Active Directory module. The PDCEmulator property holds the fully qualified name of the domain controller that owns the role, and there is one per domain.
That machine received the failed logon on behalf of the real client. Check event 4625 on it for the Source Network Address, and check 4771 (Kerberos, Client Address) and 4776 (NTLM, Source Workstation) on the domain controllers to find the client behind it.
Fix the source first, for example the service, scheduled task or device using the old password, then run Unlock-ADAccount -Identity with the SAM account name or distinguished name. If the lockout duration is not 0, the account also unlocks by itself when the duration expires.
Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.