Monitor locked out accounts in Active Directory with PRTG
05 Sep 2016PRTG can execute PowerShell scripts to query Active Directory for locked out accounts. This can be useful to help detect brute-force attacks and/or proactively detecting which users are experiencing issues logging in.
- Deploy PRTG somewhere.
- Get Paessler’s sample script here If you can’t be bothered, here’s the same script, signed with my code certificate. It’s timestamped, so it should remain valid/working even after my signing cert expires. Since it’s signed, you can easily open it, verify the contents before executing it.
- Sign it. I’d recommend you to keep the signing environment separate from your PRTG environment. Don’t put the PFX/signing key anywhere near the PRTG box.
- Deploy the signed script to your PRTG server to
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML
. - Update the ExecutionPolicy on the PRTG server. Allowing Signed scripts on the PRTG machine is probably appropriate.
Set-ExecutionPolicy AllSigned -Scope LocalMachine
- Open PowerShell (x86) (IMPORTANT: You want x86, since PRTG is x86 as well) as the domain user that PRTG uses to run the script. Run this script. You’ll have to “Always” trust the cert you signed with.
- Set up the PRTG sensor. Set the Active Directory credentials on the DC/server object with the same domain user that you used in the previous step.
- Watch
%PROGRAMDATA%\Paessler\PRTG Network Monitor\Logs (Sensors)
for any output from this sensor for debugging, if you have PRTG saving the results of the runs to a file.