Skip to content

Commit f1738a6

Browse files
authored
Merge pull request #162 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents cecdf7c + 8211b1b commit f1738a6

File tree

37 files changed

+82
-64
lines changed

37 files changed

+82
-64
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ Function Invoke-ListStandardsCompare {
1818
$Object = $_
1919
$Object.PSObject.Properties | ForEach-Object {
2020
if ($_.Name -like 'standards.*') {
21-
if ($_.Value -isnot [System.Boolean]) {
21+
if ($_.Value -is [System.Boolean]) {
22+
$_.Value = [bool]$_.Value
23+
} elseif ($_.Value -like '*{*') {
2224
$_.Value = ConvertFrom-Json -InputObject $_.Value -ErrorAction SilentlyContinue
25+
} else {
26+
$_.Value = [string]$_.Value
2327
}
2428
}
2529
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAppDeploy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Invoke-CIPPStandardAppDeploy {
5959
Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to check app $App. Error: $ErrorMessage" -sev Error
6060
}
6161
}
62-
62+
6363
if ($MissingApps.Count -gt 0) {
6464
Write-StandardsAlert -message "The following applications are not deployed: $($MissingApps -join ', ')" -object $MissingApps -tenant $Tenant -standardName 'AppDeploy' -standardId $Settings.standardId
6565
Write-LogMessage -API 'Standards' -tenant $tenant -message "The following applications are not deployed: $($MissingApps -join ', ')" -sev Info
@@ -70,7 +70,7 @@ function Invoke-CIPPStandardAppDeploy {
7070

7171
if ($Settings.report -eq $true) {
7272
$StateIsCorrect = $MissingApps.Count -eq 0 ? $true : $MissingApps
73-
Set-CIPPStandardsCompareField -FieldName 'standard.AppDeploy' -FieldValue $StateIsCorrect -TenantFilter $tenant
73+
Set-CIPPStandardsCompareField -FieldName 'standards.AppDeploy' -FieldValue $StateIsCorrect -TenantFilter $tenant
7474
Add-CIPPBPAField -FieldName 'AppDeploy' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $tenant
7575
}
7676
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAtpPolicyForO365.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ function Invoke-CIPPStandardAtpPolicyForO365 {
3232

3333
param($Tenant, $Settings)
3434
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'AtpPolicyForO365'
35-
36-
$CurrentState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AtpPolicyForO365' |
37-
Select-Object EnableATPForSPOTeamsODB, EnableSafeDocs, AllowSafeDocsOpen
38-
35+
try {
36+
$CurrentState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AtpPolicyForO365' |
37+
Select-Object EnableATPForSPOTeamsODB, EnableSafeDocs, AllowSafeDocsOpen
38+
} catch {
39+
$CurrentState = @{
40+
License = 'This tenant might not be licensed for this feature'
41+
}
42+
}
3943
$StateIsCorrect = ($CurrentState.EnableATPForSPOTeamsODB -eq $true) -and
4044
($CurrentState.EnableSafeDocs -eq $true) -and
4145
($CurrentState.AllowSafeDocsOpen -eq $Settings.AllowSafeDocsOpen)

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAuthMethodsSettings.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Invoke-CIPPStandardAuthMethodsSettings {
8888
}
8989

9090
if ($Settings.report -eq $true) {
91-
$state = $StateSetCorrectly ? $true : $CurrentPolicy
91+
$state = $StateSetCorrectly ? $true : @{CurrentReportState = $CurrentReportState; CurrentSystemState = $CurrentSystemState; WantedReportState = $ReportSuspiciousActivityState; WantedSystemState = $SystemCredentialState }
9292
Set-CIPPStandardsCompareField -FieldName 'standards.AuthMethodsSettings' -FieldValue $state -TenantFilter $tenant
9393
Add-CIPPBPAField -FieldName 'ReportSuspiciousActivity' -FieldValue $CurrentPolicy.reportSuspiciousActivitySettings.state -StoreAs string -Tenant $tenant
9494
Add-CIPPBPAField -FieldName 'SystemCredential' -FieldValue $CurrentPolicy.systemCredentialPreferences.state -StoreAs string -Tenant $tenant

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardBranding.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function Invoke-CIPPStandardBranding {
100100
}
101101

102102
If ($Settings.report -eq $true) {
103-
$state = $StateIsCorrect -eq $true ? $true : $StateIsCorrect
103+
$state = $StateIsCorrect -eq $true ? $true : ($CurrentState | Select-Object -Property signInPageText, usernameHintText, loginPageTextVisibilitySettings, loginPageLayoutConfiguration)
104104
Set-CIPPStandardsCompareField -FieldName 'standards.Branding' -FieldValue $state -TenantFilter $Tenant
105105
Add-CIPPBPAField -FieldName 'Branding' -FieldValue [bool]$StateIsCorrect -StoreAs bool -Tenant $Tenant
106106
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDeletedUserRentention.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function Invoke-CIPPStandardDeletedUserRentention {
3535
$Days = $Settings.Days.value ?? $Settings.Days
3636

3737
if ($Settings.report -eq $true) {
38-
$CurrentState = $CurrentInfo.deletedUserPersonalSiteRetentionPeriodInDays -eq $Days ? $true : $CurrentInfo.deletedUserPersonalSiteRetentionPeriodInDays
38+
$CurrentState = $CurrentInfo.deletedUserPersonalSiteRetentionPeriodInDays -eq $Days ? $true : ($CurrentInfo | Select-Object deletedUserPersonalSiteRetentionPeriodInDays)
3939
Set-CIPPStandardsCompareField -FieldName 'standards.DeletedUserRentention' -FieldValue $CurrentState -TenantFilter $Tenant
4040
Add-CIPPBPAField -FieldName 'DeletedUserRentention' -FieldValue $CurrentInfo.deletedUserPersonalSiteRetentionPeriodInDays -StoreAs string -Tenant $Tenant
4141
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableAddShortcutsToOneDrive.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Invoke-CIPPStandardDisableAddShortcutsToOneDrive {
3434
$CurrentState = Get-CIPPSPOTenant -TenantFilter $Tenant | Select-Object _ObjectIdentity_, TenantFilter, DisableAddToOneDrive
3535

3636
if ($Settings.report -eq $true) {
37-
Set-CIPPStandardsCompareField -FieldName 'standards.OneDriveAddShortcutButtonDisabled' -FieldValue $CurrentState.DisableAddToOneDrive -TenantFilter $Tenant
37+
Set-CIPPStandardsCompareField -FieldName 'standards.DisableAddShortcutsToOneDrive' -FieldValue $CurrentState.DisableAddToOneDrive -TenantFilter $Tenant
3838
Add-CIPPBPAField -FieldName 'OneDriveAddShortcutButtonDisabled' -FieldValue $CurrentState.DisableAddToOneDrive -StoreAs bool -Tenant $Tenant
3939
}
4040

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableAdditionalStorageProviders.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ function Invoke-CIPPStandardDisableAdditionalStorageProviders {
6262
}
6363

6464
if ($Settings.report -eq $true) {
65-
Set-CIPPStandardsCompareField -FieldName 'standards.AdditionalStorageProvidersEnabled' -FieldValue $AdditionalStorageProvidersState.AdditionalStorageProvidersEnabled -TenantFilter $Tenant
65+
$state = $AdditionalStorageProvidersState.AdditionalStorageProvidersEnabled ? $false : $true
66+
Set-CIPPStandardsCompareField -FieldName 'standards.DisableAdditionalStorageProviders' -FieldValue $state -TenantFilter $Tenant
6667
Add-CIPPBPAField -FieldName 'AdditionalStorageProvidersEnabled' -FieldValue $AdditionalStorageProvidersState.AdditionalStorageProvidersEnabled -StoreAs bool -Tenant $tenant
6768
}
6869
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableOutlookAddins.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Invoke-CIPPStandardDisableOutlookAddins {
7979
}
8080
if ($Settings.report -eq $true) {
8181
$State = if ($RolesToRemove) { $false } else { $true }
82-
$StateForCompare = if ($RolesToRemove) { $RolesToRemove } else { $true }
82+
$StateForCompare = if ($RolesToRemove) { @{ AllowedApps = $RolesToRemove } } else { $true }
8383
Set-CIPPStandardsCompareField -FieldName 'standards.DisableOutlookAddins' -FieldValue $StateForCompare -TenantFilter $Tenant
8484
Add-CIPPBPAField -FieldName 'DisabledOutlookAddins' -FieldValue $State -StoreAs bool -Tenant $tenant
8585
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableUserSiteCreate.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ function Invoke-CIPPStandardDisableUserSiteCreate {
6060
}
6161

6262
if ($Settings.report -eq $true) {
63-
$state = $CurrentInfo.isSiteCreationEnabled -and $CurrentInfo.isSiteCreationUIEnabled ? $true : $CurrentInfo
64-
Set-CIPPStandardsCompareField -FieldName 'standards.DisableTNEF' -FieldValue $State -Tenant $tenant
63+
$state = $CurrentInfo.isSiteCreationEnabled -and $CurrentInfo.isSiteCreationUIEnabled ? $true : ($CurrentInfo | Select-Object isSiteCreationEnabled, isSiteCreationUIEnabled)
64+
Set-CIPPStandardsCompareField -FieldName 'standards.DisableUserSiteCreate' -FieldValue $State -Tenant $tenant
6565
Add-CIPPBPAField -FieldName 'DisableUserSiteCreate' -FieldValue $CurrentInfo.isSiteCreationEnabled -StoreAs bool -Tenant $tenant
6666
Add-CIPPBPAField -FieldName 'DisableUserSiteCreateUI' -FieldValue $CurrentInfo.isSiteCreationUIEnabled -StoreAs bool -Tenant $tenant
6767
}

0 commit comments

Comments
 (0)