SHELL/2.1.1.ps1
|
$CheckId = "2.1.1" $Title = "Ensure Safe Links for Office Applications is Enabled" try { $Policies = Get-SafeLinksPolicy | Select-Object Identity,EnableSafeLinksForEmail,EnableSafeLinksForTeams,EnableSafeLinksForOffice,TrackClicks,AllowClickThrough,ScanUrls,EnableForInternalSenders,DeliverMessageAfterScan,DisableUrlRewrite $CompliantPolicies = $Policies | Where-Object { $_.EnableSafeLinksForEmail -eq $true -and $_.EnableSafeLinksForTeams -eq $true -and $_.EnableSafeLinksForOffice -eq $true -and $_.TrackClicks -eq $true -and $_.AllowClickThrough -eq $false -and $_.ScanUrls -eq $true } $Pass = @($CompliantPolicies).Count -gt 0 [pscustomobject]@{ CheckId = $CheckId Title = $Title Status = if ($Pass) { "PASS" } else { "FAIL" } Pass = $Pass Evidence = [pscustomobject]@{ Policies = @($Policies) CompliantPolicies = @($CompliantPolicies) } Error = $null Timestamp = Get-Date } } catch { [pscustomobject]@{ CheckId = $CheckId Title = $Title Status = "ERROR" Pass = $null Evidence = $null Error = $_.Exception.Message Timestamp = Get-Date } } |