Troubleshoot Active Directory Account Lockouts
Before you begin
- Applies to:Active Directory Domain Services on Windows Server 2022 or 2025.
- Where to start:Open PowerShell 7 or later on an admin workstation with the RSAT Active Directory tools. Keep the same shell for steps that share variables.
- What you need:Have the affected account and domain controller names, delegated directory read access, and access to Security logs on the relevant controllers. Unlocking requires separate delegated rights.
Guide tools
Use this guide when one domain account repeatedly locks out, especially after a password change. When many unrelated accounts lock out together, preserve the evidence and involve the security team.
Troubleshooting Steps
Confirm the account and find the PDC emulator
InventoryRun on the admin workstation. Replace alice with the affected account’s SAM account name. Record the account SID and the time reported by the user. LockedOut describes the responding controller’s current view, which can differ briefly across controllers.
$User = 'alice'$Pdc = (Get-ADDomain).PDCEmulator$Account = Get-ADUser -Identity $User -Server $Pdc -Properties LockedOut, PasswordLastSet -ErrorAction Stop$Account | Select-Object SamAccountName, SID, LockedOut, PasswordLastSet$PdcRead lockout events for the account
Event 4740Start on the PDC emulator, then repeat on the authenticating controller or in centralized logs if needed. This query displays events from the last two hours whose named event fields match the account SID. In documented 4740 XML, the caller can appear in TargetDomainName. Remote event log access failures need separate investigation. No matching event can also mean that auditing, retention, or the time window needs review.
$Filter = @{ LogName = 'Security'; Id = 4740; StartTime = (Get-Date).AddHours(-2) }Get-WinEvent -ComputerName $Pdc -FilterHashtable $Filter | ForEach-Object { $EventXml = [xml]$_.ToXml() $Fields = @{} foreach ($Entry in $EventXml.Event.EventData.Data) { $Fields[[string]$Entry.Name] = [string]$Entry.'#text' } if ($Fields.TargetSid -eq $Account.SID.Value) { $Caller = $Fields.CallerComputerName if (-not $Caller) { $Caller = $Fields.TargetDomainName } [pscustomobject]@{ TimeCreated = $_.TimeCreated DomainController = $_.MachineName User = $Fields.TargetUserName Caller = $Caller } }}Trace retries on the caller
CorrelationOn the identified Windows host, inspect services and tasks running as the account. Caller Computer Name can be blank or point to an intermediary such as a gateway. Correlate the timestamp with authentication logs, including 4625 on the system rejecting a logon and 4771 or 4776 on the relevant controller when audited. Check mapped drives and saved credentials in the affected user’s session.
Get-CimInstance Win32_Service | Select-Object Name, StartName, StateGet-ScheduledTask | Select-Object TaskPath, TaskName, @{Name='RunAs'; Expression={$_.Principal.UserId}}Correct the source and verify the unlock
VerificationHave the owner update or remove the confirmed stale credential through the service’s supported process. Keep a record of what changed and verify the dependent service or task. If the verified user is still locked out, use the delegated unlock procedure below. Confirm one normal sign-in and monitor for fresh 4740 events across at least one retry interval.
Unlock-ADAccount -Identity $User -Server $Pdc -ErrorAction StopGet-ADUser -Identity $User -Server $Pdc -Properties LockedOut | Select-Object SamAccountName, LockedOutReferences
Your feedback keeps these production procedures accurate and battle-tested.