SHELL/2.1.6.ps1
|
$CheckId = "2.1.6" $Title = "Ensure Exchange Online Spam Policies are set to notify administrators" try { $Policies = Get-HostedOutboundSpamFilterPolicy | Select-Object Identity,BccSuspiciousOutboundMail,NotifyOutboundSpam,NotifyOutboundSpamRecipients $NonCompliant = $Policies | Where-Object { $_.BccSuspiciousOutboundMail -ne $true -or $_.NotifyOutboundSpam -ne $true -or @($_.NotifyOutboundSpamRecipients).Count -eq 0 } $Pass = @($Policies).Count -gt 0 -and @($NonCompliant).Count -eq 0 [pscustomobject]@{ CheckId = $CheckId Title = $Title Status = if ($Pass) { "PASS" } else { "FAIL" } Pass = $Pass Evidence = [pscustomobject]@{ Policies = @($Policies) NonCompliant = @($NonCompliant) } Error = $null Timestamp = Get-Date } } catch { [pscustomobject]@{ CheckId = $CheckId Title = $Title Status = "ERROR" Pass = $null Evidence = $null Error = $_.Exception.Message Timestamp = Get-Date } } |