Lesson 3 of 14 · 16m
The Task Scheduler Is Cron With a Rifle Scope
Tasks are XML under System32\Tasks keyed in TaskCache, triggers go far beyond time, S4U and 'highest privileges' change the token, and ASEPs are where persistence hides.
Cron can't fire when event 1102 appears
The Task Scheduler is not a cron port. Tasks are XML files under C:\Windows\System32\Tasks, indexed by the registry cache at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache. The trigger set includes things cron can't express: at logon, at boot, on a specific event ID, on workstation unlock, on idle — with conditions like "only on AC power" or "only if this network is reachable." schtasks /query /xml ONE /tn "\Microsoft\Windows\UpdateOrchestrator\Reboot" dumps the raw document: triggers, actions, and the <Principals> block that decides whose token the task runs under.
Creating one by hand shows the shape:
schtasks /create /tn "BackupCheck" /tr "powershell -File C:\ops\check.ps1" /sc daily /st 02:00 /ru SYSTEM /rl HIGHEST/rl HIGHEST is the "highest privileges" flag; /ru SYSTEM is the principal. In the XML the same choices appear as <LogonType>S4U</LogonType> and <RunLevel>HighestAvailable</RunLevel> — the file is the truth, the GUI is a renderer.
schtasks.exe is the legacy CLI; the ScheduledTasks module (Get-ScheduledTask, New-ScheduledTask, Register-ScheduledTask) is the modern one and returns objects you can filter properly:
Get-ScheduledTask | Where-Object {$_.Actions.Execute -notlike 'C:\Windows\*'}The wrong mental model: "a scheduled task is a timed job." It's a principal-plus-trigger-plus-action registration, and the principal is where it goes sideways. The two checkboxes that matter:
- "Run whether user is logged on or not" — with "Do not store password," this is an S4U logon. The scheduler mints a token without the password, so the task cannot use saved credentials — a script that mounts a share with stored creds fails silently here.
- "Run with highest privileges" — requests the account's full token. For an admin account this is the difference between a Medium-integrity process and a High-integrity one; leave it unchecked and your "admin" task gets denied on writes that look routine.
Task folders organize the namespace — Microsoft\Windows\... is where inbox tasks live, and anything registered outside that tree stands out by construction. Operational events live in Microsoft-Windows-TaskScheduler/Operational (106 = registered, 200 = action started, 201 = completed, 322 = "the user or admin requested on-demand run"). In the Security channel, 4698 fires on task creation and 4702 on update. Those two IDs are how persistence-by-task gets caught; alert on them.
The autostart zoo
A task is one of dozens of Auto-Start Extensibility Points — the places Windows checks for "run this" at boot or logon. The ones you actually inspect:
RunandRunOnceunderHKLMandHKCU\Software\Microsoft\Windows\CurrentVersionshell:startup, which resolves to%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup- Winlogon's
ShellandUserinitvalues - Image File Execution Options
Debuggervalues — attach a "debugger" tonotepad.exeand your code launches every time notepad does - WMI permanent event subscriptions (
__EventFilter+__EventConsumer+ binding — fileless persistence, T1546.003) - COM object hijacks — register a different CLSID target and inherit whatever loads it
- Services, and the tasks themselves
The TaskCache registry side matters for forensics: TaskCache\Tree maps task paths to GUIDs, TaskCache\Tasks holds the per-task blob — including the security descriptor that controls who can even see the task, which is why some malicious tasks don't show in the console. When output and reality disagree, look at the cache.
Nobody enumerates this by hand. Sysinternals Autoruns does — autorunsc.exe -a * -c -h -s emits the complete set as CSV, and diffing it against a gold image is a real baseline, not a thought exercise. The GUI's VirusTotal lookup (autoruns.exe -vt) is built in.
There's a real-world reason this matters: scheduled-task persistence is T1053.005, and the operators know your output is long. Emotet and Qakbot named their tasks things like Microsoft\Windows\Maintenance\WinSAT precisely because Get-ScheduledTask output is a wall nobody reads. Filter it, diff it, and treat any new SYSTEM-principal task running something outside C:\Windows as an incident until proven boring.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
BlueHammer: The Unpatched Windows Zero-Day That Weaponizes Microsoft Defender Against Your Own System
BlueHammer is an unpatched, publicly released Windows local privilege escalation exploit that chains Microsoft Defender's update workflow, Volume Shadow Copy, Cloud Files callbacks, and opportunistic locks to reach NT AUTHORITY\SYSTEM from a standard user account.
A Fake GTA 6 ISO Didn’t Install a Game. It Installed a Wiper.
A fake GTA 6 ISO used a believable installer error to cover remote-access malware, browser-data theft, and destructive file wiping. The “License not found” message wasn’t the crack failing. It was there so the victim would stop looking.
Running a Minecraft Network: Four JVMs, One Box, and the Settings That Lie to You
Four servers on one host means four JVMs each sizing its thread pools for a machine it does not own. The measured cost of that, the systemd ordering that guarantees nothing, and the throttle that switches itself back on when your forwarding breaks.
Building a Minecraft Network: Four Servers Pretending to Be One Place
A proxy, a lobby, an SMP and a PvP arena is four JVMs that know nothing about each other. What actually has to be shared, why your permissions don't follow players, and the two LuckPerms defaults that silently share nothing at all.