Pcornel
Automation · Windows Automation

Scheduled Tasks

Cheat sheet · https://pcornel.dk/topic.php?topic=5668

Back to the Topic

Answer

Scheduled Tasks Automation manages Windows Task Scheduler definitions and execution while distinguishing task registration, principal/logon type, triggers/conditions, runtime invocation, result codes and downstream outcome.

Remember

  • Task registered ≠ trigger conditions will fire.
  • Manual Run success ≠ scheduled principal/environment success.
  • Last Run Result success ≠ downstream workload outcome verified.
  • Trigger fired ≠ action remained running or completed.

First checks

  • Get-ScheduledTask -TaskPath \Custom\ — custom tasks
  • Register-ScheduledTask -TaskName <n> -Action $a -Trigger $t -Principal $p — create
  • Get-ScheduledTaskInfo <n> | fl LastRunTime,LastTaskResult — result

Verify in this order

trigger → task → action → result

Where it usually breaks

Task Scheduler state proves scheduling/execution evidence only; it does not prove the action achieved its business or system outcome.

Trigger → queue accepted → worker lease/pickup → task running → terminal result → target mutation/read-back → effective runtime state → workload.

Scheduled Tasks automation proof-boundary map

BoundaryHealthy evidenceSuspicious evidence
Scope / identityExact source revision, hosts and execution identity are explicitSelector drift, stale inventory or wrong token changes scope/authority
OperationTool/provider action and per-host result are traceablePartial failure, hidden error semantics or environment differences are lost
Platform statePersistent and effective state are read backCommand/cmdlet success is mistaken for convergence
Workload proofOriginal service/application acceptance passesAutomation summary substitutes for actual runtime behavior

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5668

Confirmation

Confirm action

Continue?