File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Entrypoints/HTTP Functions/CIPP/Scheduler Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -61,12 +61,18 @@ function Invoke-ListScheduledItems {
6161 $Tasks = $Tasks | Where-Object - Property Tenant -In $AllowedTenantDomains
6262 }
6363 $ScheduledTasks = foreach ($Task in $tasks ) {
64+ if (! $Task.Tenant -or ! $Task.Command ) {
65+ continue
66+ }
67+
6468 if ($Task.Parameters ) {
6569 $Task.Parameters = $Task.Parameters | ConvertFrom-Json - ErrorAction SilentlyContinue
6670 } else {
6771 $Task | Add-Member - NotePropertyName Parameters - NotePropertyValue @ {}
6872 }
69- if ($Task.Recurrence -eq 0 -or [string ]::IsNullOrEmpty($Task.Recurrence )) {
73+ if (! $Task.Recurrence ) {
74+ $Task | Add-Member - NotePropertyName Recurrence - NotePropertyValue ' Once' - Force
75+ } elseif ($Task.Recurrence -eq 0 -or [string ]::IsNullOrEmpty($Task.Recurrence )) {
7076 $Task.Recurrence = ' Once'
7177 }
7278 try {
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ function Set-CIPPCAExclusion {
4343
4444 $RawJson = ConvertTo-Json - Depth 10 - InputObject $NewExclusions
4545 if ($PSCmdlet.ShouldProcess ($PolicyId , " Add exclusion for $UserID " )) {
46- New-GraphPOSTRequest - uri " https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$ ( $CheckExisting.id ) " - tenantid $tenantfilter - type PATCH - body $RawJSON - AsApp $true
46+ $null = New-GraphPOSTRequest - uri " https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$ ( $CheckExisting.id ) " - tenantid $tenantfilter - type PATCH - body $RawJSON - AsApp $true
4747 }
4848 }
4949
@@ -65,7 +65,7 @@ function Set-CIPPCAExclusion {
6565 }
6666 $RawJson = ConvertTo-Json - Depth 10 - InputObject $NewExclusions
6767 if ($PSCmdlet.ShouldProcess ($PolicyId , " Remove exclusion for $UserID " )) {
68- New-GraphPOSTRequest - uri " https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$ ( $CheckExisting.id ) " - tenantid $tenantfilter - type PATCH - body $RawJSON - AsApp $true
68+ $null = New-GraphPOSTRequest - uri " https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$ ( $CheckExisting.id ) " - tenantid $tenantfilter - type PATCH - body $RawJSON - AsApp $true
6969 }
7070 }
7171
You can’t perform that action at this time.
0 commit comments