How To Find Locked Active Directory Accounts Using PowerShell

This PowerShell cmdlet is very handy and can help get an overall picture of the number of locked account In Active Directory.

The command can run on windows Server 2008 R2 and above.

To search all the locked Active Directory account type:

Search-ADAccount -LockedOut | select name, objectclass

The result look like this:

To unlock all the Locked accounts type:

Search-ADAccount -LockedOut | Unlock-ADAccount