Hello,
To do what you want, you can, for example, generate the password with the help of a script and send the e-mail message with the same script. For example, the following script resets a user's password to a random sequence of 10 characters and sends it to the user's manager specified in the Manager attribute:
$newPassword = "%adm-RandomString,10%" # TODO: Modify me
$to = "%adm-ManagerEmail%" # TODO: Modify me
$subject = "Password for %name% has been reset" # TODO: Modify me
$textBody =@"
Hello,
Password for %name% has been reset. New password: $newPassword
Please do not reply to this e-mail, it has been sent to you for notification purposes only.
"@ # TODO: Modify me
$Context.TargetObject.SetPassword($newPassword)
$Context.SendMail($to, $subject, $textBody, $NULL)
In the script:
- $newPassword - specifies the template for new password generation. The %adm-RandomString% value reference in the script will be replaced with a random string generated when the Scheduled Task is executed. In the sample script it is limited to 10 characters as it often generates a very long string that goes far beyond the character limit allowed by Active Directory for passwords. For more information on value references, see the following help article: http://www.adaxes.com/help/?ValueRefere ... ormat.html.
- $to - specifies the email of the notification recipient. The %adm-ManagerEmail% value reference in the script will be replaced with the email of the user's manager specified in the Manager attribute.
- $subject - specifies the subject of the notification email.
- $textBody - specifies the body of the notification email (in plain text format).
Modify the script to your requirements.
To use this script in your Scheduled Task, you need to add the Run a program or PowerShell script action to it.