Unlocking a Locked-Out Active Directory Account and Finding the Computer That Locked It
Event 4740 on the PDC emulator names the computer behind an AD lockout. Find locked accounts with Search-ADAccount, then unlock with Unlock-ADAccount.

Before you begin
- A lab Active Directory domain at the Windows Server 2012 domain functional level or higher, with a domain-joined lab workstation.
- Domain Admins membership in the lab, needed to create a fine-grained password policy.
- The Active Directory module for Windows PowerShell (RSAT) in an elevated session.
Underlined words are defined in the KBY Lexicon. Tap or click one to see what it means.
Someone cannot sign in because their account is locked, and the obvious fix is to unlock it and move on. That only lasts until the next run of failed sign-ins if something is still trying an old password, so the real job is finding where those attempts come from. The guide covers both the unlock and the search for its cause, with a lab to practise in.
To unlock a locked-out Active Directory account, confirm the lock with Search-ADAccount -LockedOut or Get-ADUser, then run Unlock-ADAccount -Identity <user>. Before you do, find out where the bad passwords came from: lockout is processed on the domain controller that holds the PDC emulator role, and event 4740 in that controller’s Security log records the locked account and a Caller Computer Name, the computer the failed attempt arrived from. The constraint that matters is that unlocking clears the symptom, not the cause. If something on that computer, such as a forgotten session or a saved credential, is still sending an old password, the account locks again as soon as the failures reach the threshold.
A lockout is not an error in Active Directory. It is a security control doing its job: after a set number of failed sign-ins, the account can’t be used until the lockout duration passes or someone unlocks it. This guide explains the three policy settings behind that behaviour, where each piece of evidence lives, and how to trace a lockout to its source. You then build a lockout on purpose in a lab, using a policy that applies only to a test group, so you can practise every step without touching anyone’s real account.
#What you will learn
- Explain how the account lockout threshold, lockout duration and reset counter settings work together.
- Find locked-out accounts and read a user’s lockout properties with the Active Directory module for PowerShell.
- Locate the PDC emulator and read event 4740 to find the computer the failed sign-ins came from.
- Unlock an account with
Unlock-ADAccountand prove the unlock with evidence. - Decide when to unlock, when to fix the source first, and when to escalate.
#Before you begin
- A lab Active Directory domain at the Windows Server 2012 domain functional level or higher, with at least one domain-joined lab workstation.
- Membership of Domain Admins in the lab. Fine-grained password policies can only be created by Domain Admins unless that right has been delegated.
- The Active Directory module for Windows PowerShell (part of RSAT) and an elevated PowerShell session.
- Permission from whoever owns the lab to create a test user, a test group and a fine-grained password policy.
#How Active Directory decides an account is locked
#Three settings, one counter
Account lockout is controlled by three policy settings under Computer Configuration\Windows Settings\Security Settings\Account Policies\Account Lockout Policy. Account lockout threshold is the number of failed sign-in attempts, from 1 to 999, that locks the account; 0 means the account is never locked. Account lockout duration is how many minutes the account stays locked before it unlocks itself, from 1 to 99,999; 0 means it stays locked until an administrator unlocks it. Reset account lockout counter after is how many minutes must pass after a failed attempt before the failure count goes back to 0. When the threshold is above zero, the duration must be greater than or equal to the reset time.
One documented default surprises people: in the Default Domain Policy the threshold is 0, which means a domain that nobody has configured never locks accounts at all. Windows security baselines suggest a threshold of 10 as a starting point and 15 minutes for the reset counter, and Microsoft is explicit that these are guidelines, not a rule. The trade-off is real. A low threshold slows down password guessing, but anyone who knows a user name can lock that account on purpose by typing wrong passwords, which is a denial of service against that user.
Not everyone in a domain has to share the same numbers. A fine-grained password policy, stored as a password settings object (PSO), can give a different password and lockout policy to particular global security groups or users. When several PSOs could apply, the one linked directly to the user wins, and among equals the lowest Precedence value wins. Get-ADUserResultantPasswordPolicy shows the one that actually applies to a user. If you want to see what your own domain is set to, the KBY script for reading the domain password policy and every fine-grained policy reports both, read-only.
#Where the evidence lives
The Active Directory module exposes a user’s lockout state as properties derived from directory attributes. LockedOut is a true or false value derived from userAccountControl, msDS-User-Account-Control-Computed and lockoutTime. AccountLockoutTime comes from lockoutTime, BadLogonCount from badPwdCount, and LastBadPasswordAttempt from badPasswordTime. Get-ADUser returns only a default set of properties, so you ask for these with -Properties.
The properties tell you that an account is locked and when. They don’t tell you where the failures came from. For that you need the domain controller that holds the PDC emulator role. Microsoft documents three things about it that matter here: when a sign-in fails at another domain controller because of an incorrect password, the failure is forwarded to the PDC emulator before the user is told the password was wrong; password changes made at other domain controllers are replicated to it preferentially; and account lockout is processed on the PDC emulator. So the PDC emulator is the one place that normally hears about failed passwords from every other domain controller, which is why its Security log is where you look.
When an account is locked out, Windows writes event 4740, “A user account was locked out”, under the Audit User Account Management audit subcategory. Its fields include the locked account’s name and SID and, under Additional Information, Caller Computer Name: the computer account the sign-in attempt was received from, after which the account was locked. Event 4767, in the same subcategory, is written when an account is unlocked. Both events are only written if success auditing is turned on for that subcategory, so checking that is part of the job.
The flow below puts those pieces in order, from the device sending a wrong password to the administrator who unlocks the account.
Rendering diagram...

#A lockout traced in practice
A user, Sam, rings the service desk at 10:20 on a Monday: Windows says the account is locked. Sam reset their password on Friday and swears they typed it correctly this morning. That last detail is the clue. A person who types the right password and still gets locked out usually has something else trying an old one on their behalf, and the job is to find it.
Start by confirming the lock. The example output below is illustrative, from a lab, and shows what to look for rather than values you will see.
1PS C:\> Search-ADAccount -LockedOut -UsersOnly | Format-Table Name,ObjectClass -AutoSize
2
3Name ObjectClass
4---- -----------
5Sam Patel userNext, read Sam’s lockout properties. Querying the PDC emulator directly with -Server is a reasonable habit, because lockout is processed there; that is an inference from the role’s documented behaviour rather than a rule from the cmdlet page.
1PS C:\> $pdc = (Get-ADDomain).PDCEmulator
2PS C:\> Get-ADUser -Identity spatel -Server $pdc -Properties LockedOut,BadLogonCount,LastBadPasswordAttempt,AccountLockoutTime |
3 Select-Object SamAccountName,LockedOut,BadLogonCount,LastBadPasswordAttempt,AccountLockoutTime
4
5SamAccountName : spatel
6LockedOut : True
7BadLogonCount : 10
8LastBadPasswordAttempt : 23/11/2026 10:14:52
9AccountLockoutTime : 23/11/2026 10:14:52What to notice: LockedOut is true and the lockout time matches the last bad password attempt, so the final failure is the one that tipped the account over the threshold. Now ask the PDC emulator who sent it.
1PS C:\> Get-WinEvent -ComputerName $pdc -FilterHashtable @{ LogName='Security'; Id=4740; StartTime=(Get-Date).AddHours(-2) } |
2 Where-Object { $_.Message -match 'spatel' } |
3 Format-List TimeCreated, MessageIn the message, the Account That Was Locked Out section names spatel, and Additional Information shows a Caller Computer Name, in this lab LAB-WS07. Sam’s laptop is LAB-WS02. That mismatch is the finding: the failures came from another computer, one Sam signed in to last week and where a session or saved credential may still be using the old password. The fix belongs on LAB-WS07: sign Sam out there, or update the saved credential. Only then unlock the account, because unlocking first would only start the count again.
1PS C:\> Unlock-ADAccount -Identity spatel -Server $pdcRe-run the Get-ADUser command and LockedOut should now read false. The table below gathers the clues used in this example and what each one can and can’t tell you.
| Clue | Where to read it | What it tells you |
|---|---|---|
| LockedOut | Get-ADUser -Properties LockedOut | Whether the account is locked now |
| AccountLockoutTime | Get-ADUser -Properties AccountLockoutTime | When the lock happened, from the lockoutTime attribute |
| BadLogonCount | Get-ADUser -Properties BadLogonCount | Failed attempts counted so far, from badPwdCount |
| Event 4740 | Security log on the PDC emulator | Which account was locked and the caller computer the failure came from |
| Event 4767 | Security log on the domain controller that did the unlock | That the account was unlocked, and by whom |
#Try it on a lab account you lock yourself
Objective: lock a test account on purpose, find it, read event 4740 to identify the computer the failures came from, unlock it and prove the unlock.
Safe setup: work only in a lab domain. Because the Default Domain Policy has a threshold of 0, a fresh lab will never lock anyone out. Rather than change the domain-wide policy, you create a fine-grained password policy that applies only to one test group, so no other account in the lab is affected. Write down the names you use; they are the record you need for cleanup.
- Create a test user, lab.lockout, and a global security group, LabLockoutTest, with the tools you already use in your lab, and add the user to the group. Expected result: the user is a member of the group.
- On the PDC emulator, check that account management events are audited:
auditpol /get /subcategory:"User Account Management". Expected result: the setting includes Success. If it shows No Auditing, stop and ask the lab owner; changing audit policy is outside this exercise. - Create the lab policy and apply it to the test group only:
1New-ADFineGrainedPasswordPolicy -Name "LabLockoutPSO" -Precedence 10 -ComplexityEnabled $true -LockoutDuration "0.00:30:00" -LockoutObservationWindow "0.00:30:00" -LockoutThreshold 3 2Add-ADFineGrainedPasswordPolicySubject LabLockoutPSO -Subjects LabLockoutTestExpected result: both commands return without an error.
- Confirm it applies:
Get-ADUserResultantPasswordPolicy -Identity lab.lockout. Expected result:Name : LabLockoutPSOandLockoutThreshold : 3. - On a lab workstation, try to sign in as lab.lockout with a wrong password three times, then note the workstation’s name and the time.
- Set
$pdc = (Get-ADDomain).PDCEmulatorand runSearch-ADAccount -LockedOut -UsersOnly. Expected result: the test user is listed. Then read its properties with theGet-ADUsercommand from the example. Expected result:LockedOut : True. - Read event 4740 on the PDC emulator with the
Get-WinEventcommand from the example, matching onlab.lockout. Expected result: one event whose Caller Computer Name is the workstation you used. - Unlock it against the PDC emulator:
Unlock-ADAccount -Identity lab.lockout -Server $pdc. Expected result:Get-ADUsernow showsLockedOut : False, and a search of that server’s Security log for event 4767 finds the unlock, with your account as the subject.
Pass condition: the Caller Computer Name in event 4740 matches the workstation you used, and after the unlock LockedOut is false.
Stop conditions: stop if Get-ADUserResultantPasswordPolicy shows the PSO applying to any account other than the test user, if Search-ADAccount lists accounts you did not lock, or if any command returns an access-denied error. Don’t run the unlock against any account but the test user.
Cleanup and rollback: the rollback for the unlock is three more wrong passwords. To remove the lab policy, confirm by name that it is the one you created, then turn off its deletion protection and remove it: Set-ADFineGrainedPasswordPolicy -Identity LabLockoutPSO -ProtectedFromAccidentalDeletion $False followed by Remove-ADFineGrainedPasswordPolicy LabLockoutPSO. If you remove it by mistake, re-create it with the same New-ADFineGrainedPasswordPolicy and Add-ADFineGrainedPasswordPolicySubject commands. The test user and group can stay for the next exercise.
#How to check you fixed the cause
An unlock is proven by LockedOut reading false and by event 4767. That is the easy half. The harder half is proving the source is gone, and the evidence for that is absence: no new 4740 event for the account over the next reset period, and a BadLogonCount that doesn’t climb back up while the user works normally. If the count rises again, read the newest 4740 event; the Caller Computer Name may now be a different machine, because one user can have old credentials in more than one place.
Also check you were reading the right policy. If the user locks out after fewer or more attempts than the domain policy says, Get-ADUserResultantPasswordPolicy will show whether a fine-grained policy applies to them instead. And if the 4740 search returns nothing at all, check you queried the PDC emulator, that the time window covers the lockout, and that User Account Management success auditing is on; without it, the event is never written.
#Where it goes wrong when tracing a lockout
#Unlocking on repeat
Unlocking an account that keeps locking itself feels helpful and fixes nothing. Each unlock gives the stale credential another full set of attempts. Find the caller computer first, even if it takes a few minutes longer.

#Searching the wrong domain controller
The domain controller a user happens to authenticate against may not have the 4740 event you need. Lockout is processed on the PDC emulator, so start there. (Get-ADDomain).PDCEmulator tells you which server that is.
#Raising the threshold to stop the calls
Changing the domain lockout policy because one user keeps locking out treats the symptom for everyone. Setting the threshold to 0 removes the protection against password guessing for every account in the domain. A policy change is a decision for whoever owns the domain’s security baseline, not a help desk fix.
#Forgetting the screen lock
Microsoft documents that failed attempts to unlock a workstation can cause account lockout. A user who types an old password at a locked screen counts towards the threshold the same way as a failed sign-in.
#Ignoring the attacker case
A caller computer you don’t recognise, or one outside your domain, is not always a stale credential. Microsoft’s monitoring guidance recommends alerting when an account is locked out from a computer it should not be used from. Treat that as a security event and hand it on.
#What to remember
- Lockout depends on three settings: threshold, duration and the reset counter. A threshold of 0 never locks.
Search-ADAccount -LockedOutfinds locked accounts;Get-ADUserwith-Propertiesshows when and how many failures.- Lockout is processed on the PDC emulator, and event 4740 there names the caller computer.
- Fix the source on that computer before you run
Unlock-ADAccount. - A fine-grained password policy can give one group different lockout numbers; check the resultant policy before assuming.
#Unlocking accounts in a production context
In production, an unlock is a security decision as well as a support task. Confirm the caller is the account’s owner using your organisation’s identity check before you change anything, because unlocking an account for the wrong person hands them a fresh set of password guesses. Use the least privilege that does the job. We recommend an account with only the rights the task needs, delegated for the organisational units the service desk looks after, rather than Domain Admins membership, which the lab needed only for the fine-grained policy. If you need more context on how directory accounts relate to cloud accounts, cloud-only users in Microsoft Entra ID have their own recovery tasks, such as restoring a deleted user within the 30-day window.
Escalate rather than unlock when the account is privileged, when many accounts lock out at once, or when the caller computer is unknown or outside the domain: those patterns match the denial-of-service and password-guessing risks Microsoft describes for lockout policies. The rollback boundary is narrow and worth knowing. An unlock can always be undone by the policy itself, since the next run of failures locks the account again, but a change to the domain lockout policy affects every user at once. Record the account, the caller computer, the time of the 4740 event and what you changed at the source in the ticket. The next decision is whether that source should exist at all: an old session or saved credential on a machine the user no longer uses is better removed than updated.
About this page
Credited to
Dates
Published
Sources
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Recommended reading
More from KBY that goes with this article.
Related articles
Identity and Access Management
Entra ID AADSTS7000215: Invalid Client Secret Provided
AADSTS7000215 means the client secret did not match. Tell the secret value from its secret ID, check client ID, tenant and expiry, then replace and retest.
ReadConsumer tech
Google Will Close the Nest App on 25 January
Google confirmed on Friday 20 November that the Nest app closes on 25 January 2027 and Assistant leaves its speakers on 2 August. Nest devices keep working, but unlinked Nest accounts face deletion from 25 March. The checks to do now.
ReadConsumer tech
StubHub International Confirmed Last Week That Customers’ Contact Details Were Exposed
StubHub International, which runs stubhub.co.uk, says names, emails and phone numbers may have been taken. Which StubHub it is, who is not affected, the refund message to be wary of, and five things to do now.
ReadDiscover more
Lexicon Definitions
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Build practical engineering skills.
Receive new lessons, learning paths, practical exercises and early-career guidance.

Comments
Add a thoughtful note on Unlocking a Locked-Out Active Directory Account and Finding the Computer That Locked It. Comments are checked for spam and held for moderation before appearing.