Friday, February 08, 2013 9:16 PM
Does anyone have a PowerShell Script that would notify the user when their account is set to expire? I have seen powershell script for passwords set to expire but not the actual account expiration.
I would like the PowerShell to do the following:
1. Check AD for accounts that are set to expire in 7 days or less
2. Send emails to those users with Subject line and brief description in the body of email
3. Send email to an administrator as well
This script will run on a scheduled task once a week. thank you.
Friday, February 08, 2013 9:29 PMModerator
Have you searched the script repository and/or the web, and with what results?
In general, the purpose of this forum is to help answer scripting questions, not write completed scripts for others for free.
Saturday, February 09, 2013 4:57 PMModerator
This is not an easy task. However, I wrote the following script some time ago. You need to modify email settings for your environment. This sends email to the address in the "mail" attribute (Email address on "General" tab of ADUC), but if that is missing, uses the default address in the "proxyAddresses" collection. You can easily modify to also email a fixed email address (such as an admin) with another call to the SendEmail function.
Richard Mueller - MVP Directory Services
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Tuesday, March 19, 2013 7:12 PM
Tuesday, February 12, 2013 4:13 PMThanks for the script. I will test this out in my lab. I will let eveyone know if it works for me.