Unlock-ADAccount
Use Unlock-ADAccount to clear the lockout on an Active Directory account after too many failed sign-in attempts. Review examples and related commands.
Documentation: Microsoft Learn — Unlock-ADAccount
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Unlock-ADAccount [-Identity] <ADAccount> [-Server <String>] [-Credential <PSCredential>] [-PassThru] [-WhatIf] [<CommonParameters>]- Stage 1Unlock-ADAccount
-Identity -Server -Credential -PassThru -WhatIf
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Unlock-ADAccount -Identity jsmith
Show reference output
Sample output · fictional data, shaped like the real thing
DistinguishedName : CN=Sample User,OU=Users,DC=example,DC=test Enabled : True Name : Sample User SamAccountName : sample.user
Select Name, SamAccountName
Show reference output
Sample output · fictional data, shaped like the real thing
Name SamAccountName ---------- -------------- Jane Smith jsmith
Get-WinEvent -LogName Security
Show reference output
Sample output · fictional data, shaped like the real thing
TimeCreated Id Message ----------- -- ------- 9/10/2026 10:51 PM 4740 A user account was locked out.
Parameters
Parameter definitions:
-Identity-Server-Credential-PassThru-WhatIf
Practical use and troubleshooting
Practical scenario: Use Unlock-ADAccount when you need to clear the lockout on an Active Directory account after too many failed sign-in attempts. Review examples and related commands. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: An account that immediately locks again may still have a device using an old password. Find the lockout source and update the stored credential rather than repeatedly unlocking the account. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Search-ADAccount. Unlock-ADAccount clears an account lockout; Search-ADAccount finds accounts matching supported conditions. Discovery does not change the state of the accounts returned. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Unlock-ADAccount Use Unlock-ADAccount to clear the lockout on an Active Directory account after too many failed sign-in attempts. Review examples and related commands.
Next: Disable-ADAccount