Skip to content

Commit ca27d49

Browse files
Merge pull request KelvinTegelaar#1740 from Zacgoose/Reference-message-CA-and-ScheduledTasks
Reference message for multiple endpoints including scheduled tasks
2 parents 0924d62 + 3ae6748 commit ca27d49

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

Modules/CIPPCore/Public/Add-CIPPScheduledTask.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ function Add-CIPPScheduledTask {
185185
ScheduledTime = [string]$task.ScheduledTime
186186
Recurrence = [string]$Recurrence
187187
PostExecution = [string]$PostExecution
188+
Reference = [string]$task.Reference
188189
AdditionalProperties = [string]$AdditionalProperties
189190
Hidden = [bool]$Hidden
190191
Results = 'Planned'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ function Push-ExecScheduledCommand {
280280
$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>"
281281
}
282282

283-
$title = "$TaskType - $Tenant - $($task.Name)"
283+
$title = "$TaskType - $Tenant - $($task.Name)$(if ($task.Reference) { " - Reference: $($task.Reference)" })"
284284
Write-Information 'Scheduler: Sending the results to the target.'
285285
Write-Information "The content of results is: $Results"
286286
switch -wildcard ($task.PostExecution) {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUser.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ function Invoke-AddUser {
2323
value = 'New-CIPPUserTask'
2424
label = 'New-CIPPUserTask'
2525
}
26-
Parameters = [pscustomobject]@{ UserObj = $UserObj }
27-
ScheduledTime = $UserObj.Scheduled.date
28-
PostExecution = @{
26+
Parameters = [pscustomobject]@{ UserObj = $UserObj }
27+
ScheduledTime = $UserObj.Scheduled.date
28+
Reference = $UserObj.reference ?? $null
29+
PostExecution = @{
2930
Webhook = [bool]$Request.Body.PostExecution.Webhook
3031
Email = [bool]$Request.Body.PostExecution.Email
3132
PSA = [bool]$Request.Body.PostExecution.PSA

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecOffboardUser.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function Invoke-ExecOffboardUser {
3535
Email = [bool]$Request.Body.PostExecution.email
3636
PSA = [bool]$Request.Body.PostExecution.psa
3737
}
38+
Reference = $Request.Body.reference
3839
}
3940
Add-CIPPScheduledTask -Task $taskObject -hidden $false -Headers $Headers
4041
} else {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAExclusion.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ function Invoke-ExecCAExclusion {
8484
}
8585
Parameters = [pscustomobject]$Parameters
8686
ScheduledTime = $StartDate
87+
PostExecution = $Request.Body.postExecution
88+
Reference = $Request.Body.reference
8789
}
8890

8991
Write-Information ($TaskBody | ConvertTo-Json -Depth 10)
@@ -117,6 +119,7 @@ function Invoke-ExecCAExclusion {
117119
Command = @{ value = 'Set-CIPPAuditLogUserExclusion'; label = 'Set-CIPPAuditLogUserExclusion' }
118120
Parameters = [pscustomobject]@{ Users = $AuditUsers; Action = 'Remove'; Type = 'Location' }
119121
ScheduledTime = $EndDate
122+
Reference = $Request.Body.reference
120123
}
121124
Add-CIPPScheduledTask -Task $AuditRemoveTask -hidden $true
122125
}

0 commit comments

Comments
 (0)