Sending Alerts from Scripts
M
Written by Mikel Wellsmore
Updated over a week ago

Alerts can be generated via scripts using GoreloAction -Alert.

Here's an example that you can paste into a script and test against a device:

GoreloAction -Alert -Severity 1 -Text "test"

-Severity matches the various levels in Alerts:

1 = Critical (Red)

2 = Error (Orange)

3 = Warning (Yellow)

-Text is used to craft the Alert name and appears like this:

Here's an example script with variables and differing alert severity:

$DriveLetter = 'C'
$DriveInfo = Get-Volume $DriveLetter
$PcUsed = 100 - ($DriveInfo.SizeRemaining * 100.0 / $DriveInfo.Size)
if ($PcUsed -gt 20.0)
{
$Severity = 3 # Warning
if ($PcUsed -gt 25.0)
{
$Severity = 1 # Critical
}
$AlertText = $DriveLetter + " drive usage is " + $PcUsed + " %"
GoreloAction -Alert -Severity $Severity -Text $AlertText
}

Did this answer your question?