AD: Find Active Directory Lockouts

Recently I had a customer that kept getting their account locked out, due to someone try to brute force their way into the company by using the OWA portal that is hosted by their on-premise Exchange Server.  Initially trying to find this information was quite tricky and I found a really useful set of PowerShell commands that helped me find the source of the account lockouts (in this case the Exchange Server).

If you want to view the original source of the script, it can be found here:,2-848.html

This will show a nice table (sorry had to blank out the real user details!):

If you now run the following script on your DC:


This script will then search the security Event Log for any account lockouts for joebloggs.  If you then type $Events into the PowerShell window, you will get all the account lockout events associated with that user:

What we can now do is create a foreach loop, to get the client system name/IP from each event log – that will then help you to trace where the account is getting locked out:

This will then show a list of all the system names or IP’s that caused the account lockout.  I hope that helps out someone else that may be finding it difficult as to what the source of the account lockout is.