Skip to content

Commit b713768

Browse files
authored
Merge pull request KelvinTegelaar#1170 from JohnDuprey/dev
Dev
2 parents 9d0ae17 + 5178681 commit b713768

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ function Get-CIPPStandards {
22
param(
33
[Parameter(Mandatory = $false)]
44
[string]$TenantFilter = 'allTenants',
5-
[switch]$ListAllTenants
5+
[switch]$ListAllTenants,
6+
[switch]$SkipGetTenants
67
)
78

89
#Write-Host "Getting standards for tenant - $($tenantFilter)"
@@ -12,7 +13,12 @@ function Get-CIPPStandards {
1213
$StandardsAllTenants = $Standards | Where-Object { $_.Tenant -eq 'AllTenants' }
1314

1415
# Get tenant list based on filter
15-
$Tenants = Get-Tenants
16+
if ($SkipGetTenants.IsPresent) {
17+
# Debugging flag to skip Get-Tenants
18+
$Tenants = $Standards.Tenant | Sort-Object -Unique | ForEach-Object { [pscustomobject]@{ defaultDomainName = $_ } }
19+
} else {
20+
$Tenants = Get-Tenants
21+
}
1622
if ($TenantFilter -ne 'allTenants') {
1723
$Tenants = $Tenants | Where-Object { $_.defaultDomainName -eq $TenantFilter -or $_.customerId -eq $TenantFilter }
1824
}
@@ -63,8 +69,7 @@ function Get-CIPPStandards {
6369
$ComputedStandards[$StandardName] = $CurrentStandard
6470
} else {
6571
foreach ($Setting in $CurrentStandard.PSObject.Properties.Name) {
66-
# Write-Host "$Setting - Current: $($CurrentStandard.$Setting) | Computed: $($ComputedStandards[$StandardName].$($Setting))"
67-
if ($CurrentStandard.$Setting -ne $false -and ($CurrentStandard.$Setting -ne $ComputedStandards[$StandardName].$($Setting) -and ![string]::IsNullOrWhiteSpace($CurrentStandard.$Setting -or (Compare-Object $CurrentStandard.$Setting $ComputedStandards[$StandardName].$($Setting))))) {
72+
if ($CurrentStandard.$Setting -ne $false -and ($CurrentStandard.$Setting -ne $ComputedStandards[$StandardName].$($Setting) -and ![string]::IsNullOrWhiteSpace($CurrentStandard.$Setting) -or ($null -ne $CurrentStandard.$Setting -and $null -ne $ComputedStandards[$StandardName].$($Setting) -and (Compare-Object $CurrentStandard.$Setting $ComputedStandards[$StandardName].$($Setting))))) {
6873
#Write-Host "Overriding $Setting for $StandardName at tenant level"
6974
if ($ComputedStandards[$StandardName].PSObject.Properties.Name -contains $Setting) {
7075
$ComputedStandards[$StandardName].$($Setting) = $CurrentStandard.$Setting

0 commit comments

Comments
 (0)