Sending an e-mail to users whose password is about to expire

Jason BenwaySeptember 20, 2005August 31, 2015Comments Off on Sending an e-mail to users whose password is about to expire

I can’t wait until we get all of our users on the Exchange 2003 server and give this a try!

This has come up a number of times, and I actually thought I’d blogged about it in the past — but I guess not.

If you have users that only use POP and/or IMAP, and never log into via Outlook/Exchange or OWA Premium, then those users do not get notified when their password is about to expire.

You can write a script that sends your users e-mail when their passwords are about to expire. The script below is based on a Scripting Clinic article available here, with?some bug fixes and enhancements.

This script, with a few changes and enhancements, is also in my upcoming book from O’Reilly: “Essential Exchange Server 2003“.

‘‘ exch-pwd-expires.vbs‘‘ Michael B. Smith‘ March 21, 2005‘‘ This program scans all users in the Users container and all organizational units‘ beneath the HOSTING_OU organizational unit, for users whose passwords have either‘ already expired or will expire within DAYS_FOR_EMAIL days.‘‘ An email is sent, using CDO, via the SMTP server specified as SMTP_SERVER to the‘ user to tell them to change their password. You should change strFrom to match‘ the email address of the administrator responsible for password changes.‘‘ You will, at a minimum, need to change the SMTP_SERVER, the HOSTING_OU, and the‘ STRFROM constants. If you run this on an Exchange server, then SMTP_SERVER can ‘ be "127.0.0.1" – and it may be either an ip address or a resolvable name.‘‘ If you don’t have an OU containing sub-OU’s to scan, then set HOSTING_OU to the‘ empty string ("").‘

??’========================================??’ Add the number of days to the last time??’ the password was set.??’========================================??’whenPasswordExpires = DateAdd ("d", numDays, oUser.PasswordLastChanged)