Password Expiry Email Notification

This script will email a user in the event that their password is due to expire in X number of days. I have now moved it to GitHub - https://github.com/titlerequired/public

 
 
 
 
 
4.6 Star
(153)
89,029 times
Add to favorites
Active Directory
7/2/2020
E-mail Twitter del.icio.us Digg Facebook
  • Test Script on 1 user?
    2 Posts | Last post October 24, 2013
    • Hi. How can I alter this script to test on a single user? Or a single OU if that's easier? Thanks!
    • You could amend the $users variable to find a specefic user or OU. You can use -searchbase as an option.
      
      -SearchBase should be in the format of the distinguished name of the Ou you are querying.
      
      -SearchBase "DC=NA,DC=fabrikam,DC=com"
      http://technet.microsoft.com/en-us/library/ee617241.aspx
  • Mails not generating and logs needed
    6 Posts | Last post October 17, 2013
    • Hi
      I have set the Expireindays as 3. 
      Assuming that i have scheduled this script to run daily, those users whose password is going to expire in 3 days, on that current date, will get notification. Am i right?
      
      If yes, then i tested for few users, but mail has not come in for those whose password will expire in 3 days time.
      
      Also is anywhere i can see to whom and all the notifications sent for that date?
    • It would be anyone whose password expires in 3 days or less (so 3 days, 2 days, 1 day etc)
      
      I would suggest that the configuration of your mail server holds the key to working out why the emails are not sent.
      
      I have not put any logging into it particularly, but you could aways add " -cc support@mydomain.com " to be CCd to any emails that do go out.
    • Sundar, JiJi Password Expiration Notification Tool have all the features you want. You can try that, its cheap.
      
      www.jijitechnologies.com/jiji-password-expiration-notification.aspx
    • Can you just email one user?
    • Yes you can amend it to just email one user, if that person should be responsible for letting people know their password expires.
      
      Just change the $emailaddress variable to the address of the person who should receive the messages.
    • Sundaresan C, regarding logging I added this If statment at the end.
      You will need to create another variable as well as a few other lines seen below before the If starts
      
      $AllUsersExpiring = @()
      $AllUsersExpiring += "$DaystoExpire Days :`t $Name<br>"
      $AllUsersExpiring = $AllUsersExpiring | Sort-Object
      
      
      If($AllUsersExpiring.count -gt 0){
      	Send-Mailmessage -smtpServer $smtpServer -from $from -to "Usertoreceiveemail1@yourdomain.com","Usertoreceiveemail2@yourdomain.com" -subject "Expiring Users" -body "$AllUsersExpiring" -bodyasHTML -priority High
      	}	
      
      
541 - 542 of 542 Items