Add TaskCache count summary and Get-TaskCacheSummary diagnostic #4

Merged
hannah-vernon merged 1 commit from feature/taskcache-summary-diagnostic into dev 2026-07-02 09:17:52 -05:00

What does this PR do?

Adds tooling to distinguish real TaskCache corruption from a false alarm before any
destructive repair, motivated by an MVCTWS01 run that reported 197 OrphanTreeEntry findings
(mostly built-in Windows tasks).

  • Test-ScheduledTaskHealth.ps1 now emits a leading Summary record (Category = Summary)
    with the count of Tree task nodes, TaskCache\Tasks GUID keys, and on-disk XML files, plus a
    per-category finding tally. When TaskCache\Tasks holds far fewer entries than the Tree
    references (which is what produces a large batch of OrphanTreeEntry findings), it raises a
    warning: that pattern is either severe TaskCache damage or an incomplete enumeration, and
    must be verified before repairing.
  • New Get-TaskCacheSummary.ps1: a quick, read-only count comparison of the three TaskCache
    sources (Tree, Tasks, on-disk XML), with TreeWithoutTasks / TasksWithoutTree totals, an
    interpreted Assessment, and optional per-GUID spot-checks (-CheckGuid) that confirm
    directly whether a flagged orphan's Tasks key really is absent.

Fixes #

How was this tested?

  • Parser validation - 0 errors for both scripts
  • Tested against a synthetic fixture (Tree deliberately larger than Tasks): verified the
    counts, the assessment text, and the -CheckGuid spot-checks (TasksKeyExists True/False),
    and that Test-ScheduledTaskHealth.ps1 leads with the Summary record.

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Comment-based help updated for any changed parameters or behavior
  • Documentation updated (if user-visible behavior changed)
  • No commented-out code or debug leftovers
## What does this PR do? Adds tooling to distinguish real TaskCache corruption from a false alarm before any destructive repair, motivated by an MVCTWS01 run that reported 197 `OrphanTreeEntry` findings (mostly built-in Windows tasks). - `Test-ScheduledTaskHealth.ps1` now emits a leading **Summary** record (`Category = Summary`) with the count of Tree task nodes, `TaskCache\Tasks` GUID keys, and on-disk XML files, plus a per-category finding tally. When `TaskCache\Tasks` holds far fewer entries than the Tree references (which is what produces a large batch of `OrphanTreeEntry` findings), it raises a warning: that pattern is either severe TaskCache damage or an incomplete enumeration, and must be verified before repairing. - New `Get-TaskCacheSummary.ps1`: a quick, read-only count comparison of the three TaskCache sources (Tree, Tasks, on-disk XML), with `TreeWithoutTasks` / `TasksWithoutTree` totals, an interpreted `Assessment`, and optional per-GUID spot-checks (`-CheckGuid`) that confirm directly whether a flagged orphan's `Tasks` key really is absent. Fixes # ## How was this tested? - [x] Parser validation - 0 errors for both scripts - [x] Tested against a synthetic fixture (Tree deliberately larger than Tasks): verified the counts, the assessment text, and the `-CheckGuid` spot-checks (`TasksKeyExists` True/False), and that `Test-ScheduledTaskHealth.ps1` leads with the Summary record. ## Checklist - [x] I have read the [Contributing Guide](../CONTRIBUTING.md) - [x] Changes are focused - one logical change per PR - [x] Comment-based help updated for any changed parameters or behavior - [x] Documentation updated (if user-visible behavior changed) - [x] No commented-out code or debug leftovers
Test-ScheduledTaskHealth.ps1 now emits a leading Summary record (Category=Summary)
reporting the count of Tree task nodes, TaskCache\Tasks GUID keys, and on-disk XML
files, plus a per-category finding tally. When TaskCache\Tasks holds far fewer
entries than the Tree references (which produces a large batch of OrphanTreeEntry
findings), it raises a warning: that pattern is either severe TaskCache damage or an
incomplete enumeration, and must be verified before repairing.

Add Get-TaskCacheSummary.ps1: a quick, read-only count comparison of the three
TaskCache sources (Tree, Tasks, on-disk XML), with TreeWithoutTasks / TasksWithoutTree
totals, an interpreted Assessment, and optional per-GUID spot-checks (-CheckGuid) that
confirm directly whether a flagged orphan's Tasks key really is absent.

Motivated by an MVCTWS01 run that reported 197 OrphanTreeEntry findings (mostly built-in
Windows tasks); this tooling distinguishes real corruption from a false alarm before any
destructive repair.

Verified against a synthetic fixture (Tree deliberately larger than Tasks) covering the
counts, assessment, and spot-checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hannah-vernon/GmsaScheduledTaskTools!4
No description provided.