sync_intune: align Phase 3/5/6 columns; ignore benign 'Failed: 0' tails
Cosmetic + accuracy fixes spotted on the live test PC: - Phase 3 deploy/install lines had a stray double-space after the checkbox; Phase 5 'Share creds present in HKLM' and Phase 6 'Administrator renamed' had wider misalignment. All four lines collapsed to single-space-after-checkbox so the column lines up with the rest of the table. - Phase 4 status detector was greping the last 30 lines of each Install-*.log for /(?i)\b(ERROR|Failed|exception)\b/. That hit benign summary lines like 'Failed: 0' or 'Errors: 0' and marked successful runs as failed (Install-VCRedists.ps1 was the trigger -- 8/8 'Already installed - skipping' but the summary contained 'Failed: 0' and Phase 4 said FAILED). Tightened the regex to also exclude /\b(ERROR|Failed|Failures|Errors|Exceptions?)\s*[:=]\s*0\b/ so the keyword has to be next to a non-zero value (or the vocabulary 'Exit code 1603 - FAILED' style still trips correctly). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -239,7 +239,14 @@ function Get-CustomScriptStatuses {
|
|||||||
$tail = Get-Content $_.FullName -Tail 30 -ErrorAction SilentlyContinue
|
$tail = Get-Content $_.FullName -Tail 30 -ErrorAction SilentlyContinue
|
||||||
$hasError = $false
|
$hasError = $false
|
||||||
if ($tail) {
|
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 }
|
if ($errMatch) { $hasError = $true }
|
||||||
}
|
}
|
||||||
$status = if ($age -lt 30) { 'running' }
|
$status = if ($age -lt 30) { 'running' }
|
||||||
|
|||||||
Reference in New Issue
Block a user