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.

4.6 Star
81,281 times
Add to favorites
Active Directory
E-mail Twitter Digg Facebook
Sign in to ask a question

  • interval
    2 Posts | Last post Thu 3:51 PM
    • 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 :-)
  • Office 365
    3 Posts | Last post December 26, 2019
    • 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 ?
  • 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.
  • New to Powershell Scripts
    2 Posts | Last post December 05, 2019
    • From where/which server do I need to run this script and do I need to run this script on daily basis?
    • Any system with access to AD and the SMTP Server.
  • Inline images not showing
    3 Posts | Last post December 05, 2019
    • Hello, Robert, thank you for your exptremely useful script. Works ar a charm, except I tried embedding inline images as shown here:
      but I can't seem to be able to have the image to show.
      The attachment is there, the image's placeholder is there, but it doesn't show.
      I'm simply using
      $image1 = "\\fileserver\logo.png"
      In the body I have:
      <img src=""ser.png"" height=""102"" width=""215"">
      and then along the comman parameters:
      -attachments $image1
      Do you have any insight?
      Thank you ever so much
    • I actually have logo.png in the html, sorry for the typo, I just failed at generalising the filenames :)
    • it should be like this,
      $image1 = "\\fileserver\logo.png"
      <img src=""$image1"" height=""102"" width=""215"">
      -attachments $image1
  • Users are note receiving the emails after I run this script
    4 Posts | Last post November 15, 2019
    • Hello,
      Thank you for the great Script. I got an issue: I'm using office 365. By reading a previous post they mentioned that I needed to add -port 587 -UseSsl to
      Can you please advise? 
      thank you !
      Script Loaded
      *** Settings Summary ***
      SMTP Server          : -port 587 -UseSsl
      Expire in Days       : 14
      From                 :
      Logging              : False
      Log Path             : 
      Testing              : False
      Test Recipient       : 
      Report Recipient     : 
      Intervals            : 
    • Secondly, Is it possible to configure in the script with these fields?
      SMTP Server          
      Expire in Days       
      To avoid to do this manually
    • We use office 365 also.  The setting we use is ""
      example "" If you have already authorized the IP to send mail through O365, and you SPF you should be all set. We had issues getting the direct send, and had to opt for option 2 in the link below.
      The script has the fields
      SMTP Server          
      Expire in Days       
      Look in in the top section between lines 13 and 21
    • You need to add it on the Send-MailMessage line. not in the smtpserver address.
  • Different use for script
    1 Posts | Last post November 14, 2019
    • I would like to use this script in another manner, but not sure how to get it to populate for Expired accounts. Our contractor accounts expire every XX days. It would be nice if their was a sript that looked Account Expiration, and a Custom AD Attribute.
      The custom AD attribute would be the contractors manager, they would get a notice that their contractor's account is about to expire, and that they need to put a request into extend the account.
      Query for expiring account
      Get-ADUser -Filter 'enabled -eq $true' -Properties AccountExpirationDate | Select sAMAccountName, AccountExpirationDate
  • How to highlight Text in email
    5 Posts | Last post November 14, 2019
    • I am trying to use an html message and I am not getting the <mark> command to work
      I can use <h1> <h2> and <strong> tags, however, <mark> does not work? Should it?
      What am I missing? My HTML works otherwise. Below is snip of parts of the message format. This works as HTML, obliviously a few changes, but otherwise it is good.
      $body ="
      <font face=""verdana"">
             Dear $name,
      <P>  You are receiving this notice because
      <strong><mark>Section 2</strong></mark> Working over VPN\Traveling<br>
      <p>	Disconnect from VPN and then reconnect using your new password.<br>
       <h1>    Password Reset Tool </h1>
      Login to <a href=""https://someURL/owa"">Password Reset Tool</a> Step for detail, Additional detail here.
      <p>    Thanks,
    • I just wanted to add to my earlier post... the example I gave shows <<mark>... I cannot edit my post, but it should read <mark>Highlightme</mark>	
    • Your mail client may not support <h> tags.
      Try editing the text using <font> instead.
    • H Tags work. The Highlight tag does not. 
      Office 365 \ Outlook client.
    • Sorry, I called it Highlight, but the tag that does not work is the <mark> tag.
  • Non-Standard SMTP Port with 2.9 version of script?
    2 Posts | Last post November 05, 2019
    • I am trying to run the 2.9 version of the script.  I want to specify a non-standard SMTP port for my SMTP server.
      I don't see a parameter for SMTP port, nor do I see any other place in the script to configure this value.
      Anyone know how to do this?
    • You can edit the Send-MailMessage lines directly to change your SMTP port.
1 - 10 of 536 Items