Monitor for a Trigger being online

Follow

   

#
# This will verify whether the "SampleTrigger" in our Samples Folder is online
# This job can be scheduled to run throughout the day to ensure no defined Triggers have
# Accidentally been disabled and are running properly.
# This works for V6 JAMS only
#
$trig = Get-ChildItem JAMS::LOCALHOST\Samples\SampleTrigger

# Define the Triggers name and Status
$status = $trig.Status
$name = $trig.Name

# Is the status Enabled or Disabled?
if ($status -eq "Enabled") {
    Write-Host "$name is currently Enabled"
}

# Status is Disabled - send a notification
else {
    Write-Host "Trigger $name is currently Disabled"
    $SMTP = "smtpserver"
	$Subject = "$name has become Disabled"
	$Body = "Trigger: $name - is currently disabled"
	$FromAddress = "From@YourDomain.com"
	$ToAddress = "Notify@YourDomain.com"
	Send-MailMessage -To $ToAddress -Subject "$Subject" -SMTPServer $SMTP -From $FromAddress -body "$Body"
} 

   

Have more questions? Submit a request

Comments