Skip to content

Commit 2637204

Browse files
committed
Fix expected value type for comparison
1 parent cdeaa6d commit 2637204

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

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

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,27 @@ function Invoke-CIPPStandardMalwareFilterPolicy {
202202

203203
if ($Settings.report -eq $true) {
204204
$CurrentValue = $CurrentState | Select-Object Name, EnableFileFilter, FileTypeAction, FileTypes, ZapEnabled, QuarantineTag, EnableInternalSenderAdminNotifications, InternalSenderAdminAddress, EnableExternalSenderAdminNotifications, ExternalSenderAdminAddress
205+
$CurrentValue = @{
206+
Name = $CurrentState.Name
207+
EnableFileFilter = $CurrentState.EnableFileFilter
208+
FileTypeAction = $CurrentState.FileTypeAction
209+
FileTypes = $CurrentState.FileTypes
210+
ZapEnabled = $CurrentState.ZapEnabled
211+
QuarantineTag = $CurrentState.QuarantineTag
212+
EnableInternalSenderAdminNotifications = $CurrentState.EnableInternalSenderAdminNotifications
213+
EnableExternalSenderAdminNotifications = $CurrentState.EnableExternalSenderAdminNotifications
214+
}
215+
216+
if ($CurrentState.EnableInternalSenderAdminNotifications) {
217+
$CurrentValue += @{
218+
InternalSenderAdminAddress = $CurrentState.InternalSenderAdminAddress
219+
}
220+
}
221+
if ($CurrentState.EnableExternalSenderAdminNotifications) {
222+
$CurrentValue += @{
223+
ExternalSenderAdminAddress = $CurrentState.ExternalSenderAdminAddress
224+
}
225+
}
205226

206227
$ExpectedValue = @{
207228
Name = $PolicyName
@@ -211,10 +232,20 @@ function Invoke-CIPPStandardMalwareFilterPolicy {
211232
ZapEnabled = $true
212233
QuarantineTag = $Settings.QuarantineTag
213234
EnableInternalSenderAdminNotifications = $Settings.EnableInternalSenderAdminNotifications
214-
InternalSenderAdminAddress = $Settings.InternalSenderAdminAddress
215235
EnableExternalSenderAdminNotifications = $Settings.EnableExternalSenderAdminNotifications
216-
ExternalSenderAdminAddress = $Settings.ExternalSenderAdminAddress
217236
}
237+
238+
if ($Settings.EnableInternalSenderAdminNotifications) {
239+
$ExpectedValue += @{
240+
InternalSenderAdminAddress = $Settings.InternalSenderAdminAddress
241+
}
242+
}
243+
if ($Settings.EnableExternalSenderAdminNotifications) {
244+
$ExpectedValue += @{
245+
ExternalSenderAdminAddress = $Settings.ExternalSenderAdminAddress
246+
}
247+
}
248+
218249
Set-CIPPStandardsCompareField -FieldName 'standards.MalwareFilterPolicy' -CurrentValue $CurrentValue -ExpectedValue $ExpectedValue -TenantFilter $Tenant
219250
Add-CIPPBPAField -FieldName 'MalwareFilterPolicy' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $tenant
220251
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function Invoke-CIPPStandardSafeAttachmentPolicy {
195195
redirectAddress = $CurrentState.RedirectAddress
196196
}
197197

198-
$ExpectedValue = [pscustomobject]@{
198+
$ExpectedValue = @{
199199
name = $PolicyName
200200
enable = $true
201201
action = $Settings.SafeAttachmentAction

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function Invoke-CIPPStandardSpamFilterPolicy {
281281
RegionBlockList = $CurrentState.RegionBlockList
282282
AllowedSenderDomains = $CurrentState.AllowedSenderDomains
283283
}
284-
$ExpectedValue = [pscustomobject]@{
284+
$ExpectedValue = @{
285285
Name = $PolicyName
286286
SpamAction = $SpamAction
287287
SpamQuarantineTag = $SpamQuarantineTag

0 commit comments

Comments
 (0)