diff --git a/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 b/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 index 4326a4a..f32d1a9 100644 --- a/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 +++ b/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 @@ -239,7 +239,14 @@ function Get-CustomScriptStatuses { $tail = Get-Content $_.FullName -Tail 30 -ErrorAction SilentlyContinue $hasError = $false if ($tail) { - $errMatch = $tail | Where-Object { $_ -match '(?i)\b(ERROR|Failed|exception)\b' } | Select-Object -First 1 + # Filter out benign matches that come from summary/total lines like + # " Failed: 0" or "Errors: 0" or "Exceptions=0" -- the keyword + # is there but with a zero/empty value. Look for real failures: + # the keyword followed by content that is NOT just zero. + $errMatch = $tail | Where-Object { + $_ -match '(?i)\b(ERROR|Failed|exception)\b' -and + $_ -notmatch '(?i)\b(ERROR|Failed|Failures|Errors|Exceptions?)\s*[:=]\s*0\b' + } | Select-Object -First 1 if ($errMatch) { $hasError = $true } } $status = if ($age -lt 30) { 'running' } @@ -544,8 +551,8 @@ function Format-Snapshot { } $lines += "" $lines += " Phase 3: DSC deployment + install" - $lines += " $(Mk $Snap.Phase3.DeployLogExists) DSCDeployment.log present" - $lines += " $(Mk $Snap.Phase3.DeployComplete) Pre-reboot deployment complete" + $lines += " $(Mk $Snap.Phase3.DeployLogExists) DSCDeployment.log present" + $lines += " $(Mk $Snap.Phase3.DeployComplete) Pre-reboot deployment complete" $lines += " $(Mk $Snap.Phase3.InstallLogExists) DSCInstall.log present" $lines += " $(Mk $Snap.Phase3.InstallComplete) Post-reboot install complete" $lines += "" @@ -575,11 +582,11 @@ function Format-Snapshot { $lines += "" $lines += " Phase 5: SFLD credentials" $lines += " $(Mk $Snap.Phase5.ConsumeCredsTask) Consume Credentials task scheduled" - $lines += " $(Mk $Snap.Phase5.CredsPopulated) Share creds present in HKLM" + $lines += " $(Mk $Snap.Phase5.CredsPopulated) Share creds present in HKLM" $lines += "" $lines += " Phase 6: Lockdown" $lines += " $(Mk $Snap.Phase6.AutologonShopfloor) Winlogon autologon = ShopFloor" - $lines += " $(Mk $Snap.Phase6.AdminRenamed) Administrator renamed -> SFLDAdmin" + $lines += " $(Mk $Snap.Phase6.AdminRenamed) Administrator renamed -> SFLDAdmin" } else { $lines += "" $lines += " (DSC phases not applicable for $pcType)"