Skip to content

Commit

Permalink
Merge pull request #1078 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
Fix tenant name in scheduled tasks
  • Loading branch information
JohnDuprey authored Aug 19, 2024
2 parents bca97eb + adea371 commit c4aa580
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Push-ExecScheduledCommand {
$task = $Item.TaskInfo
$commandParameters = $Item.Parameters | ConvertTo-Json -Depth 10 | ConvertFrom-Json -AsHashtable

$tenant = $Item.Parameters['TenantFilter']
$tenant = $Item.Parameters.TenantFilter
Write-Host "Started Task: $($Item.Command) for tenant: $tenant"
try {
try {
Expand Down
3 changes: 2 additions & 1 deletion Scheduler_UserTasks/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $Table = Get-CippTable -tablename 'ScheduledTasks'
$Filter = "TaskState eq 'Planned' or TaskState eq 'Failed - Planned'"
$tasks = Get-CIPPAzDataTableEntity @Table -Filter $Filter
$Batch = [System.Collections.Generic.List[object]]::new()
$TenantList = Get-Tenants -IncludeErrors
foreach ($task in $tasks) {
$tenant = $task.Tenant
$currentUnixTime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
Expand All @@ -27,7 +28,7 @@ foreach ($task in $tasks) {
}

if ($task.Tenant -eq 'AllTenants') {
$AllTenantCommands = foreach ($Tenant in Get-Tenants) {
$AllTenantCommands = foreach ($Tenant in $TenantList) {
$NewParams = $task.Parameters.Clone()
$NewParams.TenantFilter = $Tenant.defaultDomainName
[pscustomobject]@{
Expand Down

0 comments on commit c4aa580

Please sign in to comment.