How to sends an email to the administrator or end-user that contains the values of CA Workload Automation iDash environment variables
Release : 12.0 +
The following powershell script will sends an email to the administrator that contains the values of CA Workload Automation iDash environment variables.
$SMTPServer = "smtp.gmail.com"
$smtpclient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$smtpClient.EnableSsl = $True
$smtpClient.Credentials = New-Object System.Net.NetworkCredential("username", "password");
$emailFrom = "yourEmail"
$emailTo= "toEmail"
$Subject = "just a test"
$Body = "on Host: $env:computername
SLA name: $env:IDASH_SLA_NAME
Display Name $env:IDASH_SLA_DISPLAY_NAME
Alarm type: $env:IDASH_HOME
Forecast start: $env:IDASH_SLA_FORECAST_TIME_START
Forecast end: $env:IDASH_SLA_FORECAST_TIME_END
Instance: $env:IDASH_SLA_JOB_INSTANCE
Job name: $env:IDASH_SLA_JOB_NAME"
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Note:
The script should reside on the iDash Server machine.
Specify the full path to the script in the SLA Definition – Script Execution section, as shown in the following example below:
Powershell.exe -executionpolicy remotesigned -File C:\Progra~1\CA\idash\etc\testemail.ps1