File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
HTTP Functions/CIPP/Scheduler Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,15 @@ function Add-CIPPScheduledTask {
6464 if ([int64 ]$task.ScheduledTime -eq 0 -or [string ]::IsNullOrEmpty($task.ScheduledTime )) {
6565 $task.ScheduledTime = [int64 ](([datetime ]::UtcNow) - (Get-Date ' 1/1/1970' )).TotalSeconds
6666 }
67-
67+ $excludedTenants = if ($task.excludedTenants.value ) {
68+ $task.excludedTenants.value -join ' ,'
69+ }
6870 $entity = @ {
6971 PartitionKey = [string ]' ScheduledTask'
7072 TaskState = [string ]' Planned'
7173 RowKey = [string ]$RowKey
7274 Tenant = $task.TenantFilter.value ? " $ ( $task.TenantFilter.value ) " : " $ ( $task.TenantFilter ) "
75+ excludedTenants = [string ]$excludedTenants
7376 Name = [string ]$task.Name
7477 Command = [string ]$task.Command.value
7578 Parameters = [string ]$Parameters
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Function Invoke-AddScheduledItem {
1414 } else {
1515 $hidden = $true
1616 }
17- $Result = Add-CIPPScheduledTask - Task $Request.body - Headers $Request.Headers - hidden $hidden - DisallowDuplicateName $Request.query.DisallowDuplicateName
17+ $Result = Add-CIPPScheduledTask - Task $Request.body - Headers $Request.Headers - hidden $hidden - DisallowDuplicateName $Request.query.DisallowDuplicateName
1818 Write-LogMessage - headers $Request.Headers - API $APINAME - message $Result - Sev ' Info'
1919
2020 Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ function Start-UserTasksOrchestrator {
3535 }
3636
3737 if ($task.Tenant -eq ' AllTenants' ) {
38- $AllTenantCommands = foreach ($Tenant in $TenantList ) {
38+ $ExcludedTenants = $task.excludedTenants -split ' ,'
39+ Write-Host " Excluded Tenants from this task: $ExcludedTenants "
40+ $AllTenantCommands = foreach ($Tenant in $TenantList | Where-Object { $_.defaultDomainName -notin $ExcludedTenants }) {
3941 $NewParams = $task.Parameters.Clone ()
4042 if ((Get-Command $task.Command ).Parameters.TenantFilter) {
4143 $NewParams.TenantFilter = $Tenant.defaultDomainName
You can’t perform that action at this time.
0 commit comments