How to send email to users with approacing password expiration

I created and scheduled a script for send email when the user password expiration is approaching.

We are on a international company, so this script have an option to specify a file where the mail body is written in the appropriate language and with the appropriate info.

Here the parameters of Send-PasswordNotify.ps1:

  • notificationGroup: it’s the Active Directory group the have the users that should receive the password expiry notification.
  • emailBodyFile: the text file that contain the body of email (the default option is mailbox.txt).
  • logFile: This is a Boolean option. If $True a log file (Send-PasswordNotify.log) is created. By default is $False. You can change the path of logfile at line 51
  • eventLog: This is a Boolean option. If $True an entry on eventlog (Scripts) is written. By default is $True.
    NOTE: You should enable/create the eventlog running this command once:

    New-EventLog -LogName "Scripts" -Source Send-PasswordNotify

    You can change the eventlog where send the info atn line 49. If you change the eventlog, remember also to enable it for this script with the command above. Example: New-EventLog -LogName “Application” -Source Send-PasswordNotify

On Send-PasswordNotify.ps1 at lines 43-51 you can fine the parameters that you can adjust, like days before the expiration, smtp server, etc.

Copy Send-PasswordNotify.ps1 and mailbox.txt on the same folder.



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