No description
  • HTML 71.8%
  • Makefile 14.4%
  • PowerShell 13.8%
Find a file
Jens Franik ac9efb382b fix: sub-minute delay support via Register-ScheduledTask + full task path fixes
task-scheduler-manager v2.2.6 / tsm-export v1.8.1 / Makefile v1.4.0

## Fixes since last commit

### Delay handling
- schtasks /delay rejects sub-minute values (minimum 1 minute)
- Sub-minute delays (e.g. 00:05) now use Register-ScheduledTask
  with ISO 8601 duration: $trigger.Delay = PT5S
- Delays >= 1 minute use schtasks /delay with correct mmmm:ss format
- 00:00 delay omits /delay entirely (was causing schtasks error)
- Fix applied in both single-task installer (buildPs1) and
  diff installer (addCreateBlock in buildDiffPs1)

### Full task path in all schtasks calls
- Tasks in subfolders (e.g. \GoogleUser\GoogleUpdater\) were failing
  because bare task name was used instead of full path
- All schtasks /create, /delete, /query, /change now use
  taskPath + taskName as fully qualified task name

### Ghost task filter in tsm-export.ps1
- Get-ScheduledTask can return stale cache entries for deleted tasks
- Each task now validated via schtasks /query before export
- Stale entries logged as [WARN] and skipped

### Self-elevating .ps1 installers
- Replaced .bat installers with self-elevating .ps1
- UAC prompt triggers automatically on double-click
- schtasks /create /sc onlogon requires elevation on Windows 10/11
  regardless of task privilege level (Windows restriction)

### Diff installer
- Generates tsm-diff-install_YYYYmmdd-HHMMSS.ps1 (was .bat)
- Applies changes to tool task list immediately on generation
- Handles ADD, REMOVE, MODIFY, STATUS-only c
2026-05-18 14:56:15 +02:00
= fix: sub-minute delay support via Register-ScheduledTask + full task path fixes 2026-05-18 14:56:15 +02:00
Makefile 'fix: sub-minute delay support via Register-ScheduledTask + full task path fixes 2026-05-18 14:55:10 +02:00
README.md Actual README.md 20260518-1430 2026-05-18 14:30:02 +02:00
task-scheduler-manager.html feat: task-scheduler-manager v2.2.3 / tsm-export v1.8.1 / Makefile v1.4.0 2026-05-18 14:17:48 +02:00
tsm-export.ps1 feat: task-scheduler-manager v2.2.3 / tsm-export v1.8.1 / Makefile v1.4.0 2026-05-18 14:17:48 +02:00

task-scheduler-manager

A standalone browser-based GUI for managing Windows logon tasks in Task Scheduler. No installation, no dependencies — open task-scheduler-manager.html in any browser.

File Version
task-scheduler-manager.html 2.2.3
tsm-export.ps1 1.8.1
Makefile 1.4.0

Files

task-scheduler-manager.html               — the browser tool
tsm-export.ps1                            — reads live Task Scheduler, writes tsm-tasks.json
Makefile                                  — syncs files between git repo and ~/HOME/
README.md / tsm-README.md                 — this file
tsm-tasks.json                            — working task list (import/export target)
tsm-tasks_YYYYmmdd-HHMMSS.json           — timestamped snapshots (Export JSON button)
<TaskName>-task-install.ps1               — self-elevating installer per task
tsm-diff-install_YYYYmmdd-HHMMSS.ps1     — diff installer for changed tasks only

Background

Windows Task Scheduler supports multiple At logon tasks but does not guarantee execution order by name or creation time. The only reliable way to control sequencing is the delay field. This tool makes that explicit and generates ready-to-run self-elevating .ps1 installers per task.

Tasks fire at logon before Explorer is fully loaded — earlier than shell:startup, saving ~1520 seconds compared to the startup folder.

schtasks /create /sc onlogon requires elevation on Windows 10/11 for all tasks regardless of privilege level. The generated .ps1 installers self-elevate via UAC automatically — no right-click needed.


Data persistence

1. localStorage   — survives page reload, browser-profile-specific
2. tsm-tasks.json — portable file for backups and cross-machine transfer

On startup: if localStorage contains tasks they load automatically. Empty → start with empty list.

On every change (new, edit, delete, enable/disable): written to localStorage immediately.

On import: file content replaces or merges with current tasks (prompt). Baseline snapshot set automatically for diff tracking.

File drift detection: on startup, if localStorage task count/names differ from the last imported file, a banner appears with a direct Import button.


Workflow

First use — seed from live Task Scheduler

1. .\tsm-export.ps1
   → validates each task via schtasks /query (filters stale cache entries)
   → exports all At-logon tasks: [USR] user + [SYS] system
   → prompt: tsm-tasks.json or timestamped backup

2. Open task-scheduler-manager.html in browser

3. Import JSON → select tsm-tasks.json
   → tasks load sorted by delay ascending
   → written to localStorage, baseline set

4. Make edits (delays, enable/disable, new tasks)

5. Export JSON for a dated backup

First use — from the browser

1. ▶ Initial read → shows tsm-export.bat
   → tsm-export.bat is a launcher shim for tsm-export.ps1
      (browsers cannot execute .ps1 directly)
   → Download or Copy, save next to tsm-export.ps1
   → double-click to run export

2. Import JSON → select tsm-tasks.json

Daily use

1. Open task-scheduler-manager.html
   → loads from localStorage automatically
   → banner prompts re-import if tsm-tasks.json was updated externally

2. Make changes → saved to localStorage on every edit

Applying changes to the machine

1. Make changes in the tool
   → △ Diff installer button appears (shows change count)
   → changes applied to tool's task list immediately

2. Click △ Diff installer
   → generates tsm-diff-install_YYYYmmdd-HHMMSS.ps1
   → self-elevating, UAC prompt triggers automatically

3. .\tsm-diff-install_YYYYmmdd-HHMMSS.ps1
   → ADD:    schtasks /create  (full task path used)
   → REMOVE: schtasks /delete  (full task path used)
   → MODIFY: delete + recreate
   → STATUS: schtasks /change /enable or /disable

4. Single task: select → Copy .ps1 installer → download/copy → run

Reset

✕ Clear all local data → removes all tasks, localStorage, baseline, file meta

tsm-export.ps1

Reads all At logon tasks from Task Scheduler. Each task is validated via schtasks /query before export — stale Get-ScheduledTask cache entries that no longer exist are skipped with a [WARN].

.\tsm-export.ps1                       # export, interactive prompt for filename
.\tsm-export.ps1 -Version              # show version and exit
.\tsm-export.ps1 -ShowVersion          # show version then run
.\tsm-export.ps1 -OutDir "C:\path"    # write to specific directory

All tasks exported — user tasks [USR] and system tasks [SYS] tagged with isSystem for filtering in the tool.

Fields per task:

Field Source
name TaskName
taskPath Full folder path (e.g. \, \GoogleUser\GoogleUpdater\)
isSystem true if path starts with \Microsoft\
actionType MSFT_TaskExecAction or MSFT_TaskComHandlerAction
delay ISO 8601 → mm:ss
script -File argument for PowerShell tasks
executable Expanded Execute path or resolved DLL for COM tasks
command Full run command — exe args for exec, schtasks /Run /TN for COM
user Principal.UserId
priv highest / limited
status enabled / disabled
window -WindowStyle argument
installerDir $PSScriptRoot — used for "Save installer to" path in tool

Installer .ps1

Self-elevating — double-click or run normally, UAC prompt appears automatically:

.\AutostartPS-task-install.ps1
.\tsm-diff-install_20260518-135548.ps1

All schtasks calls use the fully qualified task name including folder path (e.g. \GoogleUser\GoogleUpdater\GoogleUpdaterTask...) — required for tasks not in the root folder.


System tasks

Hidden by default. Toggle with System tasks button in toolbar.

System tasks under \Microsoft\* are tagged isSystem: true. They show a sys badge in the list. Two action types:

  • MSFT_TaskExecAction — normal executable, shown as full command
  • MSFT_TaskComHandlerAction — COM handler (e.g. CacheTask). Command shown as schtasks.exe /Run /TN "...". Executable shows resolved DLL from registry.

Execution order and delay

Task Scheduler does not execute At logon tasks in alphabetical or creation order. Delay is the only reliable sequencing mechanism. Tasks are sorted by delay in the list view.

Use case Delay
First task, needs network 00:05 minimum
Second task 00:15 or more
Heavy init (VMs, VPN) 00:30

00:05 minimum — below that the network stack may not be ready. 00:00 = no delay (omitted from schtasks /create).


Toolbar

Button Action
+ New task Opens new task form
↗ Import JSON Load .json — prompts Replace or Merge. Sets baseline.
↓ Export JSON Downloads tsm-tasks_YYYYmmdd-HHMMSS.json
▶ Initial read Shows tsm-export.bat launcher
△ Diff installer (N) Generates diff .ps1 for changes since baseline. Applies changes to tool immediately.
System tasks Toggle \Microsoft\* task visibility
✕ Clear all local data Wipes tasks, localStorage, baseline, file meta

Task row selected (inline detail):

Button Action
Edit Edit form pre-filled
Delete Remove after confirmation
Copy .ps1 installer Self-elevating installer — download or copy
Enable / Disable Toggle status, saves immediately
Status badge (row) Click to toggle without opening detail

Makefile

make            # help
make copy       # ~/HOME/ → git repo  (pull updates from machine)
make deploy     # git repo → ~/HOME/  (push updates to machine)
make install    # prompt for target dir, then copy
make status     # show exists/missing: source vs current dir
make clean      # remove tsm-tasks*.json and generated files

tsm-README.md preferred as source, falls back to README.md. Deploy writes README.md as tsm-README.md in target.

Override: make copy SRC_DIR=/custom/path


autostart.ps1 — logon script managed by AutostartPS task. Handles WLAN switching, HA sensor reads, app startup (Lync, Teams, Outlook, VeraCrypt, Nagstamon), VM startup, screen lock.