In this section

Windows Persistence Forensics: Scheduled Tasks, Run Keys, Services and Event 4698

Module 0

Introduction

An attacker's code stops when the machine restarts, when the user logs off, or when the process is killed. If they want it back, they need the machine to start it for them, and Windows offers many places to ask it to: services, scheduled tasks, registry keys read at logon, folders whose contents start with the desktop, and a long tail of less obvious mechanisms.

Whatever the attacker leaves in one of those places is persistence, and finding it is what makes the difference between cleaning a machine and merely rebooting it.

1. Runs at a boot or logonservices, Run keys, startup folders, logon tasks2. Runs on a schedulescheduled tasks with a time or interval trigger3. Runs on an eventWMI subscriptions, triggered tasks, file associations4. Runs when something else runsDLL search order, image hijacks, COM objects

What persistence is: a setting that starts code again without the attacker returning. The trigger is what separates the families, and the first two hold most of what an investigator finds.

This lesson reads persistence on two hosts. The first carries a scheduled task created by a trojanized installer, which is persistence in its plainest form. The second carries a service left by an attacker's tool, which looks like persistence and is not. Module 5 teaches each family in full and the audit that finds them.

01

What Persistence Is

A setting, not a process

The defining feature of persistence is that it is configuration, not activity. A running implant is a process, visible in memory while it runs and gone when it stops.

Persistence is a line in the registry, an XML file in the task store or a key under the services hive, and it sits on disk doing nothing until its trigger arrives. That makes it durable evidence: it survives reboots, it is captured by any disk collection, and it often outlives the malware's own files being cleaned up.

The families in the figure differ by trigger. Things that run at boot or logon are the most common because they are the most reliable: every working day, the user logs on.

Scheduled tasks add timing, so an implant can wake hourly or at three in the morning. Event-driven mechanisms fire on something happening, and hijacks ride on legitimate programs, running whenever those do. Module 5 reads each, including the ones most analysts miss.

Every family has the same three parts that an investigator reads: a trigger, an action, and the identity it runs as. A Run key value has an implicit trigger, the user's logon, an action, the command line in its data, and runs as that user.

A service has a start type, an image path and an account. A scheduled task has all three spelled out in its XML. Reading persistence is reading those three parts and asking whether each makes sense for what the entry claims to be:

Three parts, three families

Read every entry this way

Run key

trigger: the user's logon; action: the value's data

identity: the user whose hive holds it

Service

trigger: Start value; action: ImagePath

identity: the account the service is set to run as

Scheduled task

trigger, action and principal, all in its XML

stored as a file and indexed in the registry

The scheduled task is the richest of the three because nothing is implicit. Its XML names its trigger, its action, the account it runs as and the run level, and the task file sits in the Tasks folder under System32 while the registry keeps an index of every task. An attacker who deletes one and forgets the other leaves a mismatch, which Module 5 reads.

02

The Baseline Comes First

What a host already starts

Every Windows machine starts dozens of things on its own. Before anything can look suspicious, an investigator needs to know what ordinary looks like on that machine. On the persistence case's workstation, the user's Run key holds two values:

HKCU\Software\Microsoft\Windows\CurrentVersion\Run
  OneDriveSetup, written 2025-06-15
  C:\Users\mtaylor\AppData\Local\Microsoft\OneDrive\OneDriveSetup.exe /thfirstsetup
  Teams, written 2025-09-01
  "C:\Users\mtaylor\AppData\Local\Microsoft\Teams\Update.exe"
    --processStart "Teams.exe"

Both are ordinary: OneDrive's setup and Teams' updater, each in the user's own AppData folder, each written months before the incident, and each starting the vendor's own updater or setup program. Programs installing per-user without administrator rights put their autostart entries in exactly this key, so a path in AppData is not suspicious on its own here.

Where a Run key lives also matters. The same key exists under HKEY_LOCAL_MACHINE, where its entries start for every user who logs on and writing to it requires administrator rights.

An entry in the machine-wide key on a workstation whose users are not administrators says the attacker had already escalated when they set it. An entry in the user's own key says nothing about privilege, because every user can write to their own hive.

That is the point of reading the baseline first. The same features that make the next entry suspicious, an AppData path and a Microsoft-sounding name, are present in both legitimate entries. What separates them is everything else: when the entry was written, by what, whether the program it starts is what its name claims, and whether its behavior after starting matches.

A baseline is also time-bound. The OneDrive value was written in June 2025 and the Teams value in September, both long before anything in this case.

An investigator who sorts every autostart entry by its write time and reads from the most recent backward reaches the attacker's entries early, because persistence is usually among the newest configuration on a compromised machine. The approach fails only when the attacker backdates a timestamp, which lesson 0.8 shows how to detect.

Module 5's audit workflow formalizes this with Autoruns: collect every autostart location, filter the entries signed by known publishers, and read what is left against a known-good image of the same build. On a single machine without a reference image, the dates and the creating process carry most of the weight.

03

A Scheduled Task

Created by the program it starts

On 14 March the user downloaded what looked like an engineering calculator. Two minutes after the browser saved it, the Security log recorded a new scheduled task:

Time          2026-03-14T11:34:03Z
Event         4698, a scheduled task was created
Subject       NORTHGATEENG\mtaylor
Task name     \Microsoft Edge Update Check
Action        C:\Users\mtaylor\AppData\Local\EdgeUpdate\EdgeUpdate.exe
Computer      DESKTOP-NGE-ENG09

Microsoft's documentation describes event 4698 as generated every time a new scheduled task is created, and its guidance names two features that apply here. Tasks are often used by malware to stay on a system after reboot, and new tasks in the root of the Task Scheduler Library, a name with no folder before it, deserve attention because manually and maliciously created tasks often land there.

This one is named as a Microsoft Edge updater, sits in the root rather than in Microsoft's own folders, and runs a program from the user's AppData directory.

Sysmon recorded the command that created it, and the process that ran the command:

2026-03-14T11:34:02Z  Sysmon 1  schtasks.exe
  parent   C:\Users\mtaylor\AppData\Local\EdgeUpdate\EdgeUpdate.exe
  command  schtasks /create /tn "Microsoft Edge Update Check"
           /tr "C:\Users\mtaylor\AppData\Local\EdgeUpdate\EdgeUpdate.exe"
           /sc onlogon /rl highest

The parent of schtasks.exe is EdgeUpdate.exe itself: the program created its own task. Microsoft's schtasks documentation gives the meaning of each switch. ONLOGON runs the task whenever any user logs on, and a run level of HIGHEST runs it with the highest privileges the account has. The program arranged to restart itself at every logon, with as much privilege as it could get.

Two practical notes about the creation event. It is written only where the audit subcategory Microsoft lists for it, Other Object Access Events, is enabled, which is not a default everywhere; on a host without it, the task file's own creation time and the Sysmon or 4688 record of schtasks running are what remain. And the event carries the full task XML in its Task Content field.

The export here keeps only the action, but on a real host the XML shows the trigger and run level directly, without needing the command line.

04

Where It Came From

The installer, its files, and one unsigned library

The task points at a program, and the program came from somewhere. Sysmon's file creation and image load events record its arrival:

11:32:15  Sysmon 11  chrome.exe               wrote StructuralCalc-Setup.exe
11:33:12  Sysmon 11  StructuralCalc-Setup.exe wrote EdgeUpdate.exe
11:33:13  Sysmon 11  StructuralCalc-Setup.exe wrote msedgeupdate.dll
11:33:18  Sysmon 7   EdgeUpdate.exe           loaded msedgeupdate.dll
          signed false, signature status Unavailable

Chrome saved the installer to Downloads. The installer wrote two files into a new folder under AppData named to look like Microsoft's: an executable and a DLL. When the executable started, it loaded that DLL, and Sysmon recorded the library as unsigned.

Microsoft signs its own updater and its libraries; an unsigned library named msedgeupdate.dll, in a user's profile, loaded by a program named EdgeUpdate.exe, is a disguise that only holds until someone checks the signature.

Installer runs11:32:15saved from ChromeDrops two files11:33:12EXE and a DLLCreates a task11:34:02at logonCalls out11:35:00to a CDN-like nameFires again03/17each morning

One persistence mechanism on DESKTOP-NGE-ENG09, from the file that created it to the mornings it fired. Every link is a different record.

The library is the more interesting file. A program loads the DLLs it needs by searching a list of folders, and its own folder is searched early, so a malicious DLL placed beside an executable is loaded in place of the genuine one.

Whether EdgeUpdate.exe here is a renamed legitimate binary carrying a malicious DLL, or malicious throughout, is a question for the malware analysis the case calls for; the persistence finding is the same either way.

The chain shows why persistence is investigated backward and forward at once. Backward from the task, it leads to the program, the installer and the website the user downloaded it from. Forward, it leads to everything the program did each time it started.

A finding that names the task without its origin cannot say how to stop it recurring; one that names the origin without the task cannot say whether the machine is still compromised.

05

Proving It Fires

Configured is not the same as running

A task that exists is evidence of intent. A task that has been firing is evidence of an ongoing compromise, and the difference changes the scope of the incident. Lesson 0.2 showed Prefetch as the record of a program's runs, and the program the task starts has its own Prefetch file:

Executable   EDGEUPDATE.EXE
Path         C:\Users\mtaylor\AppData\Local\EdgeUpdate\EdgeUpdate.exe
Run count    7
Last run     2026-03-20T08:15:00Z
Earlier run  2026-03-19T08:12:00Z
Earlier run  2026-03-18T08:20:00Z
Earlier run  2026-03-17T08:10:00Z

Seven runs, the last four on consecutive mornings from 17 to 20 March. Each of those mornings has an interactive sign-in by the user in the Security log, which is what a logon trigger produces.

Seven runs is the installer's own launch on 14 March plus one for each of the six sign-ins since. The persistence did not merely exist for six days before the alert; it relaunched the attacker's program every working day.

Prefetch is the strongest record here because it counts runs regardless of how the program was started, but it is not always present. It is turned off on some server builds and can be deleted. Where it is missing, the task's own history in the Task Scheduler operational log, and each run's process creation event, carry the same proof. Module 5 reads all three.

The first time the program ran, Sysmon recorded what it did with that start:

11:36:10  whoami /all
11:36:15  ipconfig /all
11:36:20  tasklist /v
11:36:25  systeminfo
11:36:35  net user /domain
11:36:45  nltest /dclist:northgateeng
11:35:00 to 15:45:54  50 connections to cdn-assets-global.com:443

Six discovery commands in thirty-five seconds, every one a standard Windows tool asking a standard question: who am I, what network am I on, what is running, what is this machine, who are the domain's users, where are its domain controllers. Then 50 connections to cdn-assets-global.com over four hours, a few minutes apart.

That is the shape of an implant reporting in and waiting for instructions, and the task is what keeps it coming back after every restart.

The gaps between connections are worth measuring rather than describing. Here 48 of the 49 intervals are four or five minutes long and one is about ten, the regular rhythm of a program on a timer with a little randomness added so it does not look mechanical.

A person browsing produces bursts and silences; software checking in produces a pulse. The destination name is built to read as a content delivery network, which is why the rhythm and the process that made the connections, rather than the name, are what identify it.

06

A Service That Is Not Persistence

Residue from a tool

The ransomware host from lesson 0.4 carries a service that was not there before the attack. Two records describe it:

Key           HKLM\SYSTEM\CurrentControlSet\Services\PSEXESVC
ImagePath     C:\Windows\PSEXESVC.exe
DisplayName   PsExec
Start         3
Last written  2026-03-18T02:11:44Z

System log    7045, 2026-03-18T02:11:44Z, A service was installed in the system.
              PSEXESVC, user mode service, demand start

The service is named PSEXESVC, with PsExec as its display name, and the System log's event 7045 records its installation at 02:11:44 on 18 March.

PsExec's documentation describes a remote service that PsExec creates or interacts with on the system it runs against; this one was created on YORK-WS-033 itself, twenty-seven seconds before the attacker launched PsExec outward toward the file server. Which process caused it to be created here is not in this host's records, and the case investigation reads that question further.

What matters for persistence is its start type. The 7045 event records demand start, and the registry's Start value of 3 is the same setting: the service runs only when something asks for it. It will not start at the next boot. It is not a mechanism for the attacker to return; it is a tool's residue, left because the tool did not clean up after itself.

The same host shows a service changed rather than created. Seven minutes after PSEXESVC appeared, the System log recorded this:

2026-03-18T02:18:33Z  7040  VSS
  The start type of the Volume Shadow Copy service was changed from demand start t
  o disabled.

Disabling the Volume Shadow Copy service is not persistence either. It does not bring the attacker back; it stops Windows from keeping the snapshots that would let the victim restore encrypted files, and lesson 0.8 reads it among the anti-forensic steps. The service records are where both changes are written, which is why Module 5 reads service configuration as a whole rather than only looking for new entries.

Telling the two apart takes one field each time. A new service with an automatic start type and a binary in an unusual folder is a foothold until proven otherwise. A new service set to demand start, named after a known administration tool, created at the moment that tool was used, is residue. A changed service is read for what the change disables, not for what it starts.

Residue is still evidence. A PsExec service on a finance workstation is proof that an administrator-level remote execution tool ran against it, and its creation time is a fixed point on the timeline. But a report that lists it as persistence would send responders to remove a foothold that does not exist, and might stop them looking for one that does.

07

Reading Any Autostart Entry

Six questions

Both entries in this lesson, and every one in Module 5, are read against the same questions. Applied to the scheduled task:

Reading an autostart entry: the scheduled task

Persistence

What starts

EdgeUpdate.exe from the user's AppData folder

When

at any user's logon

As whom

the user, at the highest run level available

Named as

a Microsoft updater, in the library root

Made by

the program it starts, a minute after it arrived

Verdict

malicious: a disguised task that relaunches its own creator

The first four rows come from the entry itself: its action, its trigger, its run level and its name and location. The fifth comes from the process that created it, which on this host was the program the task starts. Each row alone could be innocent.

A legitimate updater runs from AppData and starts at logon. What no legitimate updater does is masquerade under another vendor's name with an unsigned library and create its own task within two minutes of a calculator installer being saved.

The same questions applied to the service give a different verdict. What starts is PsExec's service binary; when is on demand only; as whom is not recorded in this export; it is named honestly; it was made by a remote execution tool during the attack. The verdict is residue: relevant to the timeline, irrelevant to whether the attacker can come back.

The questions also expose what the evidence cannot answer. For the service, the account it runs as is not in the export; on a real host the ObjectName value under the service key holds it. A row left blank because the evidence lacks it is better than a row filled from what the entry usually looks like.

Writing the verdict as a separate row is deliberate. Responders act on it directly: a persistence finding means removal and a hunt for the same entry on other machines, a residue finding means a timeline entry. Getting it wrong in either direction costs time or leaves a door open.

08

What Module 5 Builds On It

Every family, and the audit

Module 5 takes each family in turn and ends with the audit and the timeline:

Module 5, in order

Module 5

Landscape

every autostart family, and where each is recorded

Registry

Run keys and their relatives across every hive

Tasks and services

creation events, the task XML, service keys

Less visible

WMI subscriptions, PowerShell profiles, user-level

Audit

the Autoruns triage workflow against a baseline

Timeline

multi-layer persistence and when each layer was set

The registry lessons cover the Run keys' many relatives across the system and user hives. The tasks and services lesson reads the creation events and the task XML that 4698 carries.

The less visible families, WMI event subscriptions, PowerShell profiles and user-level mechanisms, are the ones that survive an investigation that only checked the obvious places. The audit lesson is the Autoruns workflow against a baseline, and the timeline lesson puts multiple layers of persistence in the order an attacker set them.

Module 5's own case work follows the same two hosts' pattern at larger scale: a machine carrying several layers of persistence, set at different times by different stages of an intrusion, where removing one layer and missing another leaves the attacker a way back.

The habit to carry into it is the order this lesson used: know the baseline, find the entry that does not fit it, trace it backward to what created it and forward to whether it fired, and give it a verdict that says whether the attacker can return through it.

Lesson 0.6 turns from what an attacker left to what they took: the data that left a machine, and the records that show how.

Do

Practice

What was left behind to run again?
prepared evidence

The prepared evidence below is the persistence case's workstation: its autostart entries, the Sysmon events around the installer, and the mornings the dropped program ran. Separate the attacker's entry from the ordinary ones, find what created it, and decide what the run record proves.

If you have a Windows machine of your own, open Task Scheduler and expand the library root, or run schtasks /query /fo LIST /v and read the task names, actions and run levels. Most tasks live in Microsoft's own folders; anything in the root with a vendor's name is worth checking against that vendor's documentation.

Persistence is configuration that starts code again without the attacker returning, read as a trigger, an action and an identity against a known-good baseline. The scheduled task here was created by the program it starts, disguised as an updater, and proved by Prefetch to fire each morning.

The service on the ransomware host was a tool's residue, set to start on demand, and belongs on the timeline rather than on the list of footholds to remove.

Resources

Microsoft revises these pages; where a page and this lesson disagree, the page is newer.