Skip to content

Commit 6f5a133

Browse files
committed
Fix standards aggregation logic in batch apply script
Replaces the use of Where-Object with a ForEach-Object loop to correctly aggregate all standards from all tenants, ensuring that only items with FunctionName 'CIPPStandard' are included. This addresses potential issues with the previous array handling.
1 parent 3c75243 commit 6f5a133

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPStandardsApplyBatch.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ function Push-CIPPStandardsApplyBatch {
77

88
try {
99
# Aggregate all standards from all tenants
10-
$AllStandards = @($Item.Results | Where-Object { $_ -and $_.FunctionName -eq 'CIPPStandard' })
10+
$AllStandards = $Item.Results | ForEach-Object {
11+
foreach ($Standard in $_) {
12+
if ($Standard -and $Standard.FunctionName -eq 'CIPPStandard') {
13+
$Standard
14+
}
15+
}
16+
}
1117

1218
if ($AllStandards.Count -eq 0) {
1319
Write-Information 'No standards to apply across all tenants'

0 commit comments

Comments
 (0)