This article explains how to find a password locked out users list and export it as an excel file and use it for unlocking or any other purpose using a Powershell script.
Where is a need to pull out the report of password locked out users list in the active directory then you can get the list using a simple Powershell script available below.
There are many reasons users accounts get locked out, when a user enters the incorrect password multiple or exceeds maximum number times then the account gets locked out, if the user is critical resource then IT administrator has to unlock it as soon as possible, this script rally useful to pull all the locked-out user accounts in active directory.
Search-ADAccount -LockedOut -UsersOnly -ResultPageSize 500 -resultSetSize $null | Select-Object Name, SamAccountName, DistinguishedName | Export-CSV “C:\ADusers\AllLockedOutUsers.csv” -NoTypeInformation
This script pulls up to 500 user accounts which are locked out, you can change parameter value -Resultpagesize to more as per the requirement.
Thank you for reading this article, please give your feedback as comments.
Thank you for reading this article, if you have any questions please let us know.
Thank you for visiting my site, for any scripts in these articles you are testing please make sure you have tested this script in our lower environment before you run in production.
Leave a Reply Cancel reply