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