> For the complete documentation index, see [llms.txt](https://red.infiltr8.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://red.infiltr8.io/redteam/discovery/windows/scheduled-tasks.md).

# Scheduled Tasks

## Theory

In Windows, the [Task Scheduler](https://learn.microsoft.com/en-us/windows/win32/taskschd/about-the-task-scheduler) service allows to run automated tasks on a chosen computer. The tasks are used to run programms when a specific trigger occurs. Triggers work like conditions, triggering the execution of one or more actions when they are met. For example, a trigger can be temporal, linked to a particular date, launched when the system starts up, when the user logs on or in response to a Windows event.

If its misconfigured, it can be an interesting vector for privilege escalation. At the enumeration stage we are interested into following Scheduled Tasks parameters:

* The "Run As User" (i.e under which user the task will run)
* The Trigger (i.e when the task will be run)
* The task to be run (i.e what will be executed by this task)

## Practice

{% tabs %}
{% tab title="PowerShell" %}
To enumerate scheduled tasks, we may use following PowerShell commands.

```powershell
Get-ScheduledTask
```

{% endtab %}

{% tab title="CMD" %}
The command `schtasks` can be used to enumerate scheduled tasks from a cmd.

```powershell
schtasks /query /fo LIST /v
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://red.infiltr8.io/redteam/discovery/windows/scheduled-tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
