Skip to content

Commit 5d5dfb3

Browse files
add support for exclusion groups.
1 parent cd24286 commit 5d5dfb3

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ function Get-CIPPStandards {
2020
$Table = Get-CippTable -tablename 'templates'
2121
$Filter = "PartitionKey eq 'StandardsTemplateV2'"
2222
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter | Sort-Object TimeStamp).JSON |
23-
ForEach-Object {
24-
try {
25-
# Fix old "Action" => "action"
26-
$JSON = $_ -replace '"Action":', '"action":' -replace '"permissionlevel":', '"permissionLevel":'
27-
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
28-
} catch {}
29-
} |
30-
Where-Object {
31-
$_.GUID -like $TemplateId -and $_.runManually -eq $runManually
32-
}
23+
ForEach-Object {
24+
try {
25+
# Fix old "Action" => "action"
26+
$JSON = $_ -replace '"Action":', '"action":' -replace '"permissionlevel":', '"permissionLevel":'
27+
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
28+
} catch {}
29+
} |
30+
Where-Object {
31+
$_.GUID -like $TemplateId -and $_.runManually -eq $runManually
32+
}
3333

3434
# 2. Get tenant list, filter if needed
3535
$AllTenantsList = Get-Tenants
@@ -138,7 +138,15 @@ function Get-CIPPStandards {
138138

139139
if ($template.excludedTenants) {
140140
if ($template.excludedTenants -is [System.Collections.IEnumerable] -and -not ($template.excludedTenants -is [string])) {
141-
$excludedTenantValues = $template.excludedTenants | ForEach-Object { $_.value }
141+
$excludedTenantValues = $template.excludedTenants | ForEach-Object {
142+
$FilterValue = $_.value
143+
if ($_.type -eq 'Group') {
144+
($TenantGroups | Where-Object {
145+
$_.Id -eq $FilterValue
146+
}).Members.defaultDomainName
147+
} else {
148+
$FilterValue
149+
} }
142150
} else {
143151
$excludedTenantValues = @($template.excludedTenants)
144152
}

0 commit comments

Comments
 (0)