How to Utilize PowerShell to Automate Email Alerts for Crashed Applications
How to utilize PowerShell to automate email alerts for unattended applications that have crashed.
January 17, 2023
AUTHOR(S):
Chris Mills
COO
Article tags:
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share this article
This article is part of THE FOLLOWING SERIES:
Aderant Series

While unattended applications are still used by many legacy systems, they lack support for immediate recovery and fault tolerance provided by more modern service implementation.

This script provides support for alerts based on the absence of the application's process, which implies the application has crashed and needs to be tended to.

  1. Open a text editor and copy the script below:

$proc = get-process -Name "<process name>"

if([bool]$proc) {

Write-Output "The process is present"

} else {

Write-Output "The process is not present"


$EmailFrom = "<from email>"

$EmailTo = "<to email list (semicolon separated)>"

$Body = "<email body>"

$Subject = "<email subject>"

$SMTPServer = "<SMTP server>"

$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)

$SMTPClient.EnableSsl = $false

$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

}

To use the script, follow these steps:

  1. Change the "<process name>" to the name of the process you want to track. This name can be found in Task Manager or Process Monitor.

  1. Change each of the email properties enclosed in < > to your desired values.

  1. Save the script as a .ps1 file.

  1. Schedule the script to run by WIndows Scheduler, Schedule Manager, or any task scheduling application.

After following these steps, you will automatically receive email alerts whenever an unattended application crashes.

Don't miss any update on this topic.
Sign up for our newsletter to receive a personalized collection of our most recent articles, blog posts, videos, and more, curated specifically for you based on your interests.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.