Skip to content

Commit e97d981

Browse files
committed
filter list to only tenants that have standards applied
1 parent 8480bf2 commit e97d981

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-CIPPStandardsRun.ps1

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,16 @@ function Invoke-CIPPStandardsRun {
5353
Test-CIPPRerun -ClearAll -TenantFilter $TenantFilter -Type 'Standard'
5454
}
5555

56-
# Get tenant list for batch processing
57-
write-host "Getting tenants for filter: $TenantFilter"
58-
$AllTenantsList = if ($TenantFilter -eq 'allTenants') {
59-
Get-Tenants
60-
} else {
61-
Get-Tenants | Where-Object {
62-
$_.defaultDomainName -eq $TenantFilter -or $_.customerId -eq $TenantFilter
63-
}
56+
$StandardsParams = @{
57+
TenantFilter = $TenantFilter
58+
runManually = $runManually
6459
}
65-
66-
if ($AllTenantsList.Count -eq 0) {
67-
Write-Information "No tenants found for filter $TenantFilter"
68-
return
60+
if ($TemplateID) {
61+
$StandardsParams['TemplateId'] = $TemplateID
6962
}
7063

64+
$AllTenantsList = Get-CIPPStandards @StandardsParams | Select-Object -ExpandProperty Tenant | Sort-Object -Unique
65+
7166
# Build batch of per-tenant list activities
7267
$Batch = foreach ($Tenant in $AllTenantsList) {
7368
$BatchItem = @{

0 commit comments

Comments
 (0)