How to customize Notify Manager email in bulk provisioning rules
Summary: There are several automation rules in Cayosoft Administrator to provision users in bulk, for example, the Text file | Create AD Users, Import SQL Data | Create AD Users, or Import Oracle Data | Create AD Users. You can customize these rules to notify managers of created users via email, and include employee login information. So that the manager can print this email and give it to a new employee on his first day of work. There are slightly different scenarios: notify the manager about each created user in a separate email, or you notify the manager about all created users in a single email.
Applies to:Cayosoft Administrator 5.X or later.
Video Tutorial
Notify manager about each created user in an individual email
The Text file | Create AD Users, Import SQL Data | Create AD Users, and Import Oracle Data | Create AD Users rules contain the Notify Manager section that can send an email notification to the manager of the newly created user. You can customize this message.
The value in the message property should be enclosed in curly braces {}. The whole text in this property is a PowerShell script, so if you have some text in quotas inside an email message or special characters, these characters must be escaped according to PowerShell standards.
If you want to compose a complex message with some scripting or HTML formatting, you can use the $message variable for string concatenation as in the example below. Note that at the end, before the last closing bracket, you need to add a call to this variable to make it appear in the email body.
NOTE: You can add to the email subject and message any user property value in the following format: $($FoundObject.<AD User Property>), where the <AD User Property> is the LDAP name of the user property.
For example: $($FoundObject.DisplayName). If you customize automation rule <AD User Property> must be added to Properties to display setting.
In the Cayosoft Administrator Console, open a provisioning rule, for example, Text file | Create AD Users.
Expand the Notify Manager section.
Set the Notify Manager setting to Yes.
-
Replace the default text in the Subject field with this one:
Copy{"New Account Created for $($FoundObject.givenName) $($FoundObject.sn)"} -
Replace the default text in the Message field with this one:
Copy{
$managerName = "Manager" if($FoundObject.manager -ne $Null){ $mgr = Get-ADUser -Identity $FoundObject.manager -Properties * -ErrorAction Ignore if($mgr -ne $Null){ $managerName = $mgr.DisplayName } } $message = " Dear $managerName<br/><br/> New account has been created for $($FoundObject.givenName) $($FoundObject.sn).<br/><br/>
Login Name: $($FoundObject.sAMAccountName)<br/>
Password: " +[System.Security.SecurityElement]::Escape($($FoundObject.Password))+ "<br/><br/>
Email: $($FoundObject.mail)<br/><br/> " $message } Save changes.
As a result, for each created user, his manager will receive the following email:
Notify manager about all created users
In the Cayosoft Administrator Console, open a provisioning rule, for example, Text file | Create AD Users.
Expand the Notify Manager section.
Set the Notify Manager setting to Yes (Send one email for created users).
-
Replace the default text in the Subject field with this one:
Copy{"New user accounts created"} -
Replace the default text in the Message field with this one:
Copy{
$managerName = "Manager"
$managerDN=($FoundObject.manager | select -Unique)
if($Null -ne $managerDN){
$mgr = Get-ADUser -Identity $managerDN -Properties * -ErrorAction Ignore
if($Null -ne $mgr){
$managerName = $mgr.DisplayName
}
}
$message = "Dear $managerName<br/><br/>New user accounts have been created.<br/><br/>"
$FoundObject | %{
$message += "Login Name: $($_.sAMAccountName)<br/><br/>"
$message += "Password:" + [System.Security.SecurityElement]::Escape($_.Password)+ "<br/><br/>"
$message += "Email: $($_.mail)<br/><br/>"
$message += "<hr/><br/>"
}
$message
} Save changes.
As a result, when every new user is created, their manager will receive the following email:
Comments
0 comments
Please sign in to leave a comment.