From 8aa4c8b3bdb2f4e72027dc919e4c4a135171f841 Mon Sep 17 00:00:00 2001 From: jessikitty Date: Fri, 27 Feb 2026 10:26:00 +1100 Subject: [PATCH] List not-found AD accounts individually in the log --- Update-StaffAD.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Update-StaffAD.ps1 b/Update-StaffAD.ps1 index 43c990b..e0e2974 100644 --- a/Update-StaffAD.ps1 +++ b/Update-StaffAD.ps1 @@ -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 ""