Password Change Reminder PowerShell Script Updated!

powershell2xa4Back in 2012 i wrote a script to help me remind users about their password expiry, to reduce the number of calls i got on the helpdesk. I decided to share it and published it on the TechNet Gallery,

It has been quite popular since then, with over 8,000 downloads!

Throughout that time i have received a number of questions about how to tweak the script to do various things or fix bugs and errors that people have found.

I have been tweaking it as i go, without much notification to anyone. I have just finished quite a big change, so i thought i would put up a post here, to let people know.

So what’s new?

Comments. Well firstly i added a lot more comments to the script itself. Not very exciting, but for those wanting to tweak it themselves, kind of important.


Logging. I have added logging so any notifications generated can also be outputted into a CSV file.


Testing. A lot of people wanted to be able to test it, but not have users emailed directly, so now you can have all notifications emailed to a separate address. Which you can see in the above email, all the emails going to .


As always i welcome any comments or suggestions for the script over at the TechNet Gallery.

I have posted a troubleshooting guide here.

About Robert Pearman
Robert Pearman is a UK based Small Business Server enthusiast. He has been working within the SMB IT Industry for what feels like forever. Robert likes Piña colada and taking walks in the rain, on occasion he also enjoys writing about Small Business Technology like Windows Server Essentials or more recently writing PowerShell Scripts. If you're in trouble, and you can find him, maybe you can ask him a question.

2 Responses to Password Change Reminder PowerShell Script Updated!

  1. Wayne Riddle says:

    This chnage makes it so if the password expires in 1 day it says 1 day instead of 1 days
    if (($messageDays) -gt “1”)
    $messageDays = “in ” + “$daystoexpire” + ” days”
    elseif (($messageDays) -eq “1”)
    $messageDays = “in ” + “$daystoexpire” + ” day”
    $messageDays = “today”

    • I think I actually updated that in a newer version of the script:

      # Check Number of Days to Expiry
      $messageDays = $daystoexpire

      if (($messageDays) -ge "1")
      $messageDays = "in " + "$daystoexpire" + " days."
      $messageDays = "today."

      Your way may be better though :)

Leave a reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: