It never fails.  Users will always try to run the clock out on password expiration despite being notified on their devices of the impending doom.  The script below is an attempt to help remind them of this doom.

Intro

You’ll need to fill in a few variables at the top of the script.  You’ll also need Quest AD tools.

Sample Emails

The script will generate two emails.  One is sent to the user.  The other is sent to the admins as a summary.

User Email

password-expiration-user

Summary Email

password-expiration-summary

I typically run this daily at midnight as a scheduled task.  Since the script write the results to the event log, you should run this elevated to prevent any errors.  A negative number for the days indicates the password has already expired.

Code – Password Expiration.ps1

This script is available on my Bitbucket as well.

Conclusion

Hopefully this helps you out.  If you find bugs or have suggestions, feel free to report them below or on Bitbucket.

Leave a Reply

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