Password change notification via powershell

We will create a PowerShell script which will notify the users as soon as they change their password. we will send a Thank you e-mail. This job will run a scheduled base, I found 2 hours very well fits my scenario

The user has to be a member of one security group, you can use domain users, or specific user group Anyway here is the script that I created, Please change the variables base of your requirements

Import-module activedirectory
$date = get-date
$users = Get-ADGroupMember -Identity group-name | Get-ADUser  -properties Name, PasswordExpired, PasswordLastSet, EmailAddress |where {$_.Enabled -eq "True"} | where PasswordLastSet | ? {$_.PasswordLastSet -gt $date.addhours(-2) }

foreach ($USER in $USERS){
#$Name = $user.Name
$givenname =$user.GivenName
$emailaddress = $user.emailaddress
$emailSmtpServer = "X.X.X.X"
$emailFrom = "IT Dept  <[email protected]>"
$emailSubject = "Password Change Confirmation"
$link1= '<a href="http://it.YOURCOMPANY.COM">http://it.YOURCOMPANY.COM/</a>'
$link2= '<a href="http://it.YOURCOMPANY.COM/clear-windows-credential-manager">http://it.YOURCOMPANY.COM/clear-windows-credential-manager</a>'
$emailBody = @"

<font face="arial">
<p>Dear $Givenname : </p>
 <p>Thank you for changing your password!<br />In compliance with our security policies, all COMPANY passwords will henceforth be expiring every 10 months; and they must be different from the previous one.
  You will be receiving another notification prior to the next expiration date.<br />Please, make sure to update your mobile devices as necessary.
   If your desktop Office applications (Outlook, OneNote, Word, Skype, …) continually prompt for passwords, proceed as indicated in the below link.  
   It might take up to 5 minutes for your new password to sync to cloud applications.<br />$link2<br /><br />Regards,<br />IT Department<br />$link1</p></FONT>

Send-MailMessage -To $emailaddress -From $emailFrom -Subject $emailSubject -Body $emailBody -BodyAsHTML -SmtpServer $emailSmtpServer