PowerScripts Email Alerting

Through the use of multiple helper scripts, Email can be configured to be sent out through PowerScripts


About PowerScripts Email Alerting

Using PowerShell's native commands to send emails, we can leverage this ability to allow PowerScripts to send Alert or Notification Emails.

To accomplish this, we have created multiple helper scripts to facilitate this operation.

The first of these scripts is the ScriptEmailSetup.ps1 script. This script locally stores all the required information to connect to an SMTP server and route an email. The script requires the following:

  • SMTP Server Name (Fully Qualified)
  • SMTP Port
  • Email of user to authenticate as
  • Password of that user
  • Who these emails should go to
  • Who the emails should be from

The second of these scripts is the SendEmail.ps1 script. This script can't be directly run in VitalSigns, but it utilizes the information stored by the first script, as well as being passed further information/content from the third script.

The third script is any script that calls the second script. It is this script that defines the content of the email message. The script is called like so:

$Body | & "$(Split-Path $PSScriptRoot -Parent)\Common\SendEmail.ps1" -Subject "Example Subject"



The First Script's parameters: