You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$message="Group membership match: $($Email.ToString()) is a member of Group $($groupObjectId)"
361
-
if ($ShowDetailedExplanation) {
362
-
Write-Host"`t`t$message"
363
-
} else {
364
-
Write-Verbose$message
365
-
}
350
+
Write-DetailedExplanationOption-Message "Group membership match: $($Email.ToString()) is a member of Group $($groupObjectId)"-ShowDetailedExplanation:$ShowDetailedExplanation
366
351
break
367
352
} else {
368
-
$message="No Group match because $($Email.ToString()) is not a member of Group $($groupObjectId)"
369
-
if ($ShowDetailedExplanation) {
370
-
Write-Host"`t`t$message"
371
-
} else {
372
-
Write-Verbose$message
373
-
}
353
+
Write-DetailedExplanationOption-Message "No Group match because $($Email.ToString()) is not a member of Group $($groupObjectId)"-ShowDetailedExplanation:$ShowDetailedExplanation
374
354
break
375
355
}
376
356
}
@@ -379,32 +359,17 @@ begin {
379
359
380
360
if ($exceptMemberOf) {
381
361
foreach ($groupEmailin$exceptMemberOf) {
382
-
$message="Checking if recipient is in excluded Group $groupEmail"
383
-
if ($ShowDetailedExplanation) {
384
-
Write-Host"`t`t$message"
385
-
} else {
386
-
Write-Verbose$message
387
-
}
362
+
Write-DetailedExplanationOption-Message "Checking if recipient is in excluded Group $groupEmail"-ShowDetailedExplanation:$ShowDetailedExplanation
$message="Excluded from rule by group membership. $($Email.ToString()) is in excluded Group $($groupObjectId)"
395
-
if ($ShowDetailedExplanation) {
396
-
Write-Host"`t`t$message"
397
-
} else {
398
-
Write-Verbose$message
399
-
}
369
+
Write-DetailedExplanationOption-Message "Excluded from rule by group membership. $($Email.ToString()) is in excluded Group $($groupObjectId)"-ShowDetailedExplanation:$ShowDetailedExplanation
400
370
break
401
371
} else {
402
-
$message="$($Email.ToString()) is not excluded from rule by membership in Group $($groupObjectId)"
403
-
if ($ShowDetailedExplanation) {
404
-
Write-Host"`t`t$message"
405
-
} else {
406
-
Write-Verbose$message
407
-
}
372
+
Write-DetailedExplanationOption-Message "$($Email.ToString()) is not excluded from rule by membership in Group $($groupObjectId)"-ShowDetailedExplanation:$ShowDetailedExplanation
408
373
break
409
374
}
410
375
}
@@ -414,21 +379,11 @@ begin {
414
379
$temp=$Email.Host
415
380
while ($temp.IndexOf(".") -gt0) {
416
381
if ($temp-in$domainsIs) {
417
-
$message="Domain is in rule: $temp. Other conditions must match also."
418
-
if ($ShowDetailedExplanation) {
419
-
Write-Host"`t`t$message"
420
-
} else {
421
-
Write-Verbose$message
422
-
}
382
+
Write-DetailedExplanationOption-Message "Domain is in rule: $temp. Other conditions must match also."-ShowDetailedExplanation:$ShowDetailedExplanation
423
383
$domainInRule=$true
424
384
}
425
385
if ($temp-in$exceptIfDomainsIs) {
426
-
$message="Excluded from rule by domain: $temp"
427
-
if ($ShowDetailedExplanation) {
428
-
Write-Host"`t`t$message"
429
-
} else {
430
-
Write-Verbose$message
431
-
}
386
+
Write-DetailedExplanationOption-Message "Excluded from rule by domain: $temp"-ShowDetailedExplanation:$ShowDetailedExplanation
432
387
$domainExceptionInRule=$true
433
388
}
434
389
$temp=$temp.Substring($temp.IndexOf(".") +1)
@@ -439,47 +394,22 @@ begin {
439
394
if (((($emailInRule-or (-not$senderOrReceiver)) -and ($domainInRule-or (-not$domainsIs)) -and ($groupInRule-or (-not$memberOf))) -and
Write-DetailedExplanationOption-Message "Policy match found: `"$($rule.Name)`""-ShowDetailedExplanation:$ShowDetailedExplanation
398
+
Write-DetailedExplanationOption-Message "Included in rule as User: $emailInRule. Included in rule by Group membership: $groupInRule. Included in rule by Domain: $domainInRule."-ShowDetailedExplanation:$ShowDetailedExplanation
399
+
Write-DetailedExplanationOption-Message "Excluded from rule as User: $emailExceptionInRule. Excluded from rule by group membership: $groupExceptionInRule. Excluded from rule by domain: $domainExceptionInRule."-ShowDetailedExplanation:$ShowDetailedExplanation
454
400
return$rule
455
401
} else {
456
-
$message="The rule/policy does not explicitly include the recipient because not all User, Group, and Domain properties which have values include the recipient. `n`t`tDue to the AND operator between the User, Group, and Domain inclusion properties, if any of those properties have non-null values (they are not empty), the recipient must be included in that property."
457
-
$messageDetail="Included in rule as User: {0}. Included in rule by Group membership: {1}. Included in rule by Domain: {2}."
458
-
$messageDetail2="Excluded from rule as User: {0}. Excluded from rule by group membership: {1}. Excluded from rule by domain: {2}."
Write-DetailedExplanationOption-Message "The rule/policy does not explicitly include the recipient because not all User, Group, and Domain properties which have values include the recipient. `n`t`tDue to the AND operator between the User, Group, and Domain inclusion properties, if any of those properties have non-null values (they are not empty), the recipient must be included in that property."-ShowDetailedExplanation:$ShowDetailedExplanation
403
+
Write-DetailedExplanationOption-Message "Included in rule as User: $emailInRule. Included in rule by Group membership: $groupInRule. Included in rule by Domain: $domainInRule."-ShowDetailedExplanation:$ShowDetailedExplanation
404
+
Write-DetailedExplanationOption-Message "Excluded from rule as User: $emailExceptionInRule. Excluded from rule by group membership: $groupExceptionInRule. Excluded from rule by domain: $domainExceptionInRule."-ShowDetailedExplanation:$ShowDetailedExplanation
468
405
}
469
406
470
407
# Check for implicit inclusion (no mailboxes included at all), which is possible for Presets and SA/SL. They are included if not explicitly excluded. Only inbound
$message="The recipient is IMPLICITLY included. There are no recipients explicitly included in the policy, and the user is not explicitly excluded either in the User, Group, or Domain exclusion properties. `n`t`tImplicit inclusion is possible for Preset policies and Safe Attachments and Safe Links in which no explicit inclusions have been made."
475
-
$messageDetail="Rule of matching policy: `"$($rule.Name)`""
476
-
if ($ShowDetailedExplanation) {
477
-
Write-Host"`t`t$message"
478
-
Write-Host"`t`t$messageDetail"
479
-
} else {
480
-
Write-Verbose$message
481
-
Write-Verbose$messageDetail
482
-
}
411
+
Write-DetailedExplanationOption-Message "The recipient is IMPLICITLY included. There are no recipients explicitly included in the policy, and the user is not explicitly excluded either in the User, Group, or Domain exclusion properties. `n`t`tImplicit inclusion is possible for Preset policies and Safe Attachments and Safe Links in which no explicit inclusions have been made."-ShowDetailedExplanation:$ShowDetailedExplanation
412
+
Write-DetailedExplanationOption-Message "Rule of matching policy: `"$($rule.Name)`""-ShowDetailedExplanation:$ShowDetailedExplanation
0 commit comments