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 -

4.6 Star
94,227 times
Add to favorites
Active Directory
E-mail Twitter Digg Facebook
  • username not correct
    4 Posts | Last post March 12, 2020
    • I can get the correct username in the notification mail, but the username will show a question mark in the report.
      My language tag is ZH-TW
    • Is it ? for the whole user, or just the characters in cannot interpret?
      The encoding is set to UTF-8 at the beginning so perhaps try a different one?
    • correct format : Jacky Tsao (曹玄聰)
      fault format : Jacky Tsao (???)
      The  CSV file received incorrect content.
      How can i modify the program code when the CSV file is exporting.
    • It is an issue with how powershell displays characters, so you will need to make sure your console is set with the right locale information.
      I dont have much experience of it im afraid, this may be useful.
  • When choosing test user , only this user will get an email , correct?
    2 Posts | Last post February 09, 2020
    • When choosing test user , only this user will get an email , correct?    
    • That's correct because 
       $emailaddress = $testRecipient on line 276
  • The specified string is not in the form required for an e-mail address.
    1 Posts | Last post January 30, 2020
    • Hi all,
      We experience a problem with sending the emails from the script. When I am using the testing parameter everything looks ok: the logs says Send-email OK and I receive the e-mail.
      When we omnit -testing the users don't reveive the email and in the log there's an error message. When using the -Status parameter we see the error "The specified string is not in the form required for an email address." on the console. However the $emailaddress is filled with a correct email address string.
  • reportTo
    1 Posts | Last post January 30, 2020
    • Hello Robert, (and everyone)
      Everything works, I'm in a 365 environment, with a 2012r2 AD. The only thing that does not work is the shipment report to our tech service mailbox. I provide my order without sensitive information :
      -command "C:\SCRIPTS\MAIL_REMINDER\Mail_Reminder_Pwd_Expire.ps1 -smtpServer -expireInDays 15 -from 'Service Informatique <passwordexprire@****.fr>' -logging -LogPath C:\SCRIPTS\MAIL_REMINDER\LOGS -reportTo informatique@****.fr -interval 1,2,5,10"
      Regards !
  • Task Scheduler
    1 Posts | Last post January 29, 2020
    • Hi Robert, 
      Thanks for sharing this script, it's fantastic. I tested it a few times and it works great. However, when I tried to create a schedule task with the script and run it, it will prompt for smtp server? I tried to enter -command "C:\PasswordChangeNotification.ps1 -smtpServer -expireInDays 14 -from "IT Support <>" -Logging -LogPath "c:\temp" -testing -testRecipient" in the argument section. This does not work as well. I used the testing to test the notification in the scheduler before blasting to all users. I am connecting to my smtp server with no authentication. Appreciate your advice.
  • Error
    3 Posts | Last post January 29, 2020
    • PS D:\Password_Reminder_Scripts> .\PasswordChangeNotification.ps1 -smtpServer exch-mb -expireInDays 309 -from "Password Reminder <>" -logging =logPath D:\Password_Reminder_Scripts\Logging -testing -testRecipient
      D:\Password_Reminder_Scripts\PasswordChangeNotification.ps1 : Cannot process argument transformation on parameter 'status'. Cannot convert value 
      "System.String" to type "System.Management.Automation.SwitchParameter". Boolean parameters accept only Boolean values and numbers, such as 
      $True, $False, 1 or 0.
      At line:1 char:150
      + ... .com>" -logging =logPath D:\Password_Reminder_Scripts\Logging -testin ...
      +                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidData: (:) [PasswordChangeNotification.ps1], ParameterBindingArgumentTransformationException
          + FullyQualifiedErrorId : ParameterArgumentTransformationError,PasswordChangeNotification.ps1
    • You have an '=' where you should have a '-'
    • Thank you, sorry I missed that.
      With the test, I am getting emails for everyone regardless of what the age is.
  • Office 365
    4 Posts | Last post January 28, 2020
    • I am trying to setup my Scheduled Task but it seems that it does not like the credentials for O365.  I have tried using a domain admin account and my own but I can't get past the login during testing.  Any ideas?
    • Review this,
    • The link don't work.
      Any solution ?
    • Try this,
  • interval
    2 Posts | Last post January 16, 2020
    • Hello Robert,
      i have a question about your script. when i start it manually - everything works correctly. in report i see that the emails were sent correctly.
      but when i put it into task scheduler i see in the report: Skipped - interval
      what should be wrong? of course i am talking about the same person.
      10	Tom	Tom	Li		30. 7. 2019 10:00:38	10	26. 1. 2020 10:00:38	OK
      10	Tom	TOM	Li		30. 7. 2019 10:00:38	10	26. 1. 2020 10:00:38	Skipped - Interval
      Thank you
    • I already solved it, thanks :-)
  • Task Scheduler disables this script
    2 Posts | Last post December 25, 2019
    • Hello
      I added this script to task scheduler as shown on youtube video. But task scheduler disables this script itself. I enable but 1 sec later it disable again.
      What is the problem? Can you help me?
      Have a nice day,
      Best Regards
    • Hi guy,
      This is normal, windows treats plan tasks like that. It starts and then stops the task, etc. Depending on the frequency. Trying to follow a complete loop by refreshing the window
  • Never installed a script before
    2 Posts | Last post December 05, 2019
    • Hello,
      I am currently assisting on building the company's infrastructure, and I was asked to look into sending an email out to our employees on letting them know that their password will expire soon. Where do I add this script and how do I add it without any issues? Thank you in advance.
    • Well id like to tell you how to do it without issues but i cannot.
      You can use the instructions in the youtube videos on how to setup and schedule the script.
1 - 10 of 542 Items