I currently have a Powershell script which returns a custom array of Active Directory users, if their account is locked out and the date when their password is expiring. The list of AD users is read from a text file, easily maintained by IT personel with no PRTG knowledge. The goal of this script is to let us know if a service account's password is expiring soon or is currently locked out. Currently, the Powershell script is outputing to an array (PSCustomObject).
We would like to get this script into PRTG so that PRTG can alert us if :
1. An account's password is expiring in a few days. (Ideally, the limit could be set into PRTG and not hardcoded in the script.) 2. If an account is locked out.
I'm trying to get my head into how to integrate this into PRTG and keep it as dynamic as possible. Ideally, if we would like to add or remove a user from the list, we could just edit the text file and PRTG would read the new JSON/XML file that is generated with the modified users. If that is even possible in PRTG.
Currently the output arrays contains the following values :
Username DisplayName PwdNeverExpires LockedOut PasswordExpiryDate DaysBeforeExpiration
PRTG needs only the Username, LockedOut and DaysBeforeExpiration (the script uses a TimeSpan to calculate the number of days before the password expires).
Can I create all of this within 1 sensor (multiple users with their own value) ?
Right now, I can't think of any other options than to create 1 sensor per user (pass the username in paramter to the script) and each sensor has 2 channels :
- LockedOut which would trigger an alarm if True is read - DaysBeforeExpiration which would trigger based on a limit in PRTG
But, creating 1 sensor per user defeats the purpose of having a simple text file to add/remove users easily. I understand this might not be possible, and this is why I decided to ask around here to see if I'm trying to do the impossible in PRTG :)