Skip to content

Commit bd78c00

Browse files
authored
Merge pull request #603 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents cea969e + 57ad95c commit bd78c00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-ExecScheduledCommand.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ function Push-ExecScheduledCommand {
272272

273273
# Add alert comment if available
274274
if ($task.AlertComment) {
275-
$HTML += "<div style='background-color: #f8f9fa; border-left: 4px solid #007bff; padding: 15px; margin: 15px 0;'><h4 style='margin-top: 0; color: #007bff;'>Alert Information</h4><p style='margin-bottom: 0;'>$($task.AlertComment)</p></div>"
275+
if ($task.AlertComment -match '%resultcount%') {
276+
$resultCount = if ($Results -is [array]) { $Results.Count } else { 1 }
277+
$task.AlertComment = $task.AlertComment -replace '%resultcount%', "$resultCount"
278+
}
279+
$task.AlertComment = Get-CIPPTextReplacement -Text $task.AlertComment -TenantFilter $Tenant
280+
$HTML += "<div style='background-color: transparent; border-left: 4px solid #007bff; padding: 15px; margin: 15px 0;'><h4 style='margin-top: 0; color: #007bff;'>Alert Information</h4><p style='margin-bottom: 0;'>$($task.AlertComment)</p></div>"
276281
}
277282

278283
$title = "$TaskType - $Tenant - $($task.Name)"

0 commit comments

Comments
 (0)