fix: 2.1.1,2.1.4,2.1.5 surpress error messages and create a standard object when no e5

This commit is contained in:
DrIOS
2024-06-14 09:23:03 -05:00
parent 273630839e
commit ccacf76e6c
3 changed files with 49 additions and 39 deletions

View File

@@ -40,12 +40,11 @@ function Test-SafeLinksOfficeApps {
}
process {
# Retrieve all Safe Links policies
[void]($policies = Get-SafeLinksPolicy)
if ($null -ne $policies) {
if (Get-Command Get-SafeLinksPolicy -ErrorAction SilentlyContinue) {
try {
# 2.1.1 (L2) Ensure Safe Links for Office Applications is Enabled
# Retrieve all Safe Links policies
$policies = Get-SafeLinksPolicy
# Initialize the details collection
$misconfiguredDetails = @()