Fix Register-CWAAHealthCheckTask drift detection and failure-path logging - #11
Merged
christaylorcodes merged 4 commits intoJul 27, 2026
Merged
Conversation
Promote to stable 2.1.0
…ging Broadens the existing-task comparison to cover InstallerToken, Server, LocationID, and IntervalHours together instead of just the token, so config changes actually recreate the task. Adds post-create verification via Get-ScheduledTask (the incident this fixes is a task getting removed immediately after creation) and fixes Write-CWAAEventLog never firing on the failure path when the caller has $ErrorActionPreference = 'Stop'. +semver: patch
…ledTasks dependency The new post-create verification step logged a 4023 error event when the task was missing, but still fell through into the success path (4020 log, Created=$true). Verification failure now gates the success reporting so callers get an accurate Created/Updated result. Also replaces Get-ScheduledTask with an schtasks-based check for the same verification, since ScheduledTasks module requires PS 3.0+/Win8+ and the rest of this function intentionally shells out to schtasks.exe for broader compatibility. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI resolves build dependencies fresh on every run with no lockfile/cache, and
Sampler was pinned to 'latest'. A newer Sampler release (0.120.0) changed the
built-module output path resolution, breaking the Create_changelog_release_output
task ("Could not find the built module manifest"). Pin to the version already
verified locally via ./Tests/test-local.ps1.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
schtasksand then removed immediately by AV/policy) that now actually gates success reporting: on verification failure, the function logs event 4023, skips the 4020 success log, and returnsCreated=$falseinstead of falsely reporting success.schtasks /QUERYcheck instead ofGet-ScheduledTask, keeping the function on PowerShell 2.0/3.0-compatible tooling (theScheduledTasksmodule requires PS 3.0+/Windows 8+) and consistent with the existingschtasks-based existence check.Write-CWAAEventLogstill logs the 4022 failure event even when the caller has$ErrorActionPreference = 'Stop'.Created=$falseresult and that 4020 is not also logged), and the creation-failure path.Write-CWAAEventLog's event ID reference.Test plan
./Scripts/Invoke-QuickTest.ps1 -IncludeAnalyzer -OutputFormat Structured→ success, 0 failed, 0 analyzer errors./Tests/test-local.ps1→ build, analyze, and test stages all pass (483 passed, 0 failed, 8 skipped)🤖 Generated with Claude Code