#!perl ############################################################ # # ITS Locked Account Monitor Script # # v1.0 - Walt Howd # # # This script is designed to monitor the number of locked accounts. If this number rises it will notify # an administrator via e-mail. # # # REQUIREMENTS: # 1. unlock.exe in the PATH (http://www.joeware.net/win/free/tools/unlock.htm) # ############################################################ ############################################################ # Global Variables ############################################################ $lockedThreshold = 10; $unlockCmd = "unlock.exe . * -view 2>NUL"; @notifyList = qw( admin ); $mailFrom = "AccountLockout"; $mailSubject = "Account Lockout Alert"; $mailServer = "mailserver.domain.com"; $mailBodyHeader = <= $lockedThreshold ) { $smtp = Net::SMTP->new($mailServer); foreach (@notifyList) { $mailTo = $_; print "Notifying $mailTo via e-mail. . .\n\n"; $smtp->mail($mailFrom); $smtp->to($mailTo); $smtp->data(); $smtp->datasend("Subject: $mailSubject\n"); $smtp->datasend("From: $mailFrom\n"); $smtp->datasend("To: $mailTo\n"); $smtp->datasend("\n"); $smtp->datasend($mailBodyHeader . $lockedAccountsList); $smtp->dataend(); } $smtp->quit; }