Password expiration notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2010 09:46 AM
I have been tasked to look into the possibility of using Service-Now to notify users of pending password expiration.
Something along the line of 15, 10, and 5 days before the expiration date, an email notification is sent alerting users of the pending expiration.
I have managed to be able to pull the expiration date from our LDAP into the sys_user table in a datetime field named u_password_expires.
I am currently attempting to devise a scheduled script that would run nightly and compare the current date to the expiration date which would then fire an appropriate notification for 15 days out, 10 days out, and then 5 days out.
As I am NOT a javascript person, I am having trouble finding a comparable script OOB that I could modify for my needs.
Has anyone done something similar?
- Labels:
-
Analytics and Reports

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2010 10:51 AM
We run a scheduled job every monday morning that checks ad account expirations to see if they will expire between 4 and 5 weeks from now and sends emails to managers asking if the account in question is still needed. Here is an example of my code:
//4 weeks from now in seconds
var begtime = 2419200;
//5 weeks from now in seconds
var endtime = 3024000;
var acct = new GlideRecord('sys_user');
acct.addNotNullQuery('u_ad_account_expiration');
acct.query();
while (acct.next()) {
//get the time in seconds between now and when the account expires
var diff = gs.dateDiff(gs.nowDateTime().getDisplayValue(), acct.u_ad_account_expiration.getDisplayValue(), true);
//see if that time falls in our window
if (diff >= begtime && diff <= endtime ) {
doYourNotification();
}
We only have a couple hundred accounts with ad expiration dates and this is run at 5AM, so there's no performance hit, but I think if your query returns a lot more accounts you might want to write it differently.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2012 01:47 PM
Hi Shill,
I hope you can help me with this. I'm currently trying to pull in the account expired date from AD. Do you mind share with me how you do it?
When I mapped the account expired date field with custom field in user table. the field is blank. nothing is coming over. Not sure why.
Thanks