Scheduled Task Resource
Synopsis
Manages Windows scheduled tasks, including triggers, actions, and task settings.
Type
Capabilities
- Get
- Set
- Delete
- Export
Properties
taskName
The name of the scheduled task.
taskPath
The folder path containing the task.
triggers
The triggers that start the task.
actions
The actions the task performs.
user
The user context the task runs under.
enabled
Whether the task is enabled.
_exist
Whether the task should exist.
Note
This resource uses an embedded JSON schema due to the complexity of its
nested trigger and action objects.
Use dsc resource schema -r OpenDsc.Windows/ScheduledTask to view the full
schema.
Examples
Example 1 — Get a scheduled task
Example 2 — Configuration document
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Daily cleanup task
type: OpenDsc.Windows/ScheduledTask
properties:
taskName: DailyCleanup
taskPath: \MyTasks\
enabled: true
actions:
- execute: C:\Scripts\cleanup.bat
triggers:
- daily:
daysInterval: 1
startBoundary: "2026-01-01T02:00:00"
Exit codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error |
| 2 | Invalid JSON |
| 3 | Access denied |
| 4 | Invalid argument |