forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DisableAdditionalStorageProviders standard
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableAdditionalStorageProviders.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function Invoke-CIPPStandardDisableAdditionalStorageProviders { | ||
<# | ||
.FUNCTIONALITY | ||
Internal | ||
#> | ||
param($Tenant, $Settings) | ||
|
||
$AdditionalStorageProvidersState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OwaMailboxPolicy' -cmdParams @{Identity = 'OwaMailboxPolicy-Default' } | ||
|
||
if ($Settings.remediate) { | ||
|
||
try { | ||
if ($AdditionalStorageProvidersState.AdditionalStorageProvidersEnabled) { | ||
New-ExoRequest -tenantid $Tenant -cmdlet 'Set-OwaMailboxPolicy' -cmdParams @{ Identity = $AdditionalStorageProvidersState.Identity; AdditionalStorageProvidersEnabled = $false } | ||
Write-LogMessage -API 'Standards' -tenant $tenant -message 'OWA additional storage providers disabled.' -sev Info | ||
} else { | ||
Write-LogMessage -API 'Standards' -tenant $tenant -message 'OWA additional storage providers are already disabled.' -sev Info | ||
} | ||
} catch { | ||
Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to disable OWA additional storage providers. Error: $($_.Exception.Message)" -sev Error | ||
} | ||
|
||
} | ||
|
||
if ($Settings.alert) { | ||
|
||
if ($AdditionalStorageProvidersState.AdditionalStorageProvidersEnabled) { | ||
Write-LogMessage -API 'Standards' -tenant $tenant -message 'OWA additional storage providers are enabled' -sev Alert | ||
} else { | ||
Write-LogMessage -API 'Standards' -tenant $tenant -message 'OWA additional storage providers are disabled' -sev Info | ||
} | ||
} | ||
|
||
if ($Settings.report) { | ||
|
||
Add-CIPPBPAField -FieldName 'AdditionalStorageProvidersEnabled' -FieldValue [bool]$AdditionalStorageProvidersState.AdditionalStorageProvidersEnabled -StoreAs bool -Tenant $tenant | ||
} | ||
} |