From 2a25f3542c3279f46b68a92642b362a79b5fc727 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Fri, 23 Aug 2024 11:50:02 +0200 Subject: [PATCH] Display some logs --- Private/Invoke-PasswordRuleProcessing.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Private/Invoke-PasswordRuleProcessing.ps1 b/Private/Invoke-PasswordRuleProcessing.ps1 index 33cc72e..0e1f596 100644 --- a/Private/Invoke-PasswordRuleProcessing.ps1 +++ b/Private/Invoke-PasswordRuleProcessing.ps1 @@ -308,7 +308,7 @@ } } if ($SendToManager -and $Rule.SendToManager.Manager.IncludeGroup.Count -gt 0) { - # Rule defined that only user withi specific group has to be found + # Rule defined that only user within specific group has to be found $FoundGroup = $false foreach ($Group in $Rule.SendToManager.Manager.IncludeGroup) { if ($User.MemberOf -contains $Group) { @@ -415,6 +415,13 @@ Add-ManagerInformation @Splat } } + } else { + if ($Rule.SendToManager.Manager) { + # Manager rule is enabled but manager is not enabled or has no email + if ($Logging.NotifyOnUserMatchingRuleForManagerButNotCompliant) { + Write-Color -Text "[i]", " User (manager rule) ", $User.DisplayName, " (", $User.UserPrincipalName, ")", " days to expire: ", $User.DaysToExpire, ", manager status: ", $User.ManagerStatus, ". Reason to skip: ", "No manager or manager is not enabled or manager has no email " -Color Yellow, White, Yellow, White, Yellow, White, White, Red, White, Red, White, Red + } + } } } # Lets find users that have no manager, manager is not enabled or manager has no email