One of my customers wanted something to alert users when their passwords are about to expire via email but also to alert the company IT contact/secretary so that they can also ensure passwords are being changed. This was due to a lot of users ignoring the warning and notification going on holiday or for the weekend and their Mobile devices and remote access stopped working (which is always somehow the IT companies fault! 🙂 )

Powershell Script Below:

This script is setup using Task Scheduler to run at 9AM and 5PM every Mon-Fri.

If you want to test the script works my advice is to change the $emailaddress and ITCONTACT@ONSITE.COM to the administrator@DOMAIN.COM email account so when you run the script all the users dont get alerts and warnings.

$expireindays = the amount of days left to start notifying users
$alert = the amount of days left to start notifying the onsite contact.

The script does require you allow relaying on the Exchange Server.

Leave a Reply

Your email address will not be published. Required fields are marked *