List not-found AD accounts individually in the log
This commit is contained in:
@@ -52,6 +52,7 @@ $emailUpdates = 0
|
||||
$disables = 0
|
||||
$noChanges = 0
|
||||
$notFound = 0
|
||||
$notFoundList = @()
|
||||
|
||||
foreach ($entry in $Deduped.Values) {
|
||||
$samAccount = $entry.PAYROLL_REC_NO.Trim()
|
||||
@@ -65,6 +66,7 @@ foreach ($entry in $Deduped.Values) {
|
||||
-ErrorAction Stop
|
||||
} catch {
|
||||
$notFound++
|
||||
$notFoundList += $samAccount
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -115,5 +117,10 @@ Write-Log " Email updates : $emailUpdates"
|
||||
Write-Log " Accounts disabled : $disables"
|
||||
Write-Log " No changes needed : $noChanges"
|
||||
Write-Log " Not found in AD : $notFound"
|
||||
if ($notFoundList.Count -gt 0) {
|
||||
foreach ($missing in $notFoundList) {
|
||||
Write-Log " - $missing" "Yellow"
|
||||
}
|
||||
}
|
||||
Write-Log $RunHeader
|
||||
Write-Log ""
|
||||
|
||||
Reference in New Issue
Block a user