Pcornel
Browse topics
Options
Recent
Favorites
Windows · Technical reference

Triggers

Direct answer

Task triggers start scheduled tasks: on a schedule, at startup, at logon, on idle, on a specific event log entry, or when a session connects or locks. One task can have several triggers.

When to use this

Use this when choosing what starts a scheduled task.

First 30 seconds

1. (Get-ScheduledTask <name>).Triggers — type and schedule.

2. Enabled and not expired?

3. Time zone/synchronise across time zones?

4. Event triggers: correct log and XPath.

5. Test with Start-ScheduledTask.

Operational verification

trigger (time, logon, startup, event) → fires → task queued

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • "At log on" tasks that run for every user when only one was intended.
  • Event triggers with XPath filters that never match — test with Event Viewer custom views first.
  • Time triggers in local time causing double/missed runs at DST changes.
  • Random delay not used, so hundreds of machines hit a server at the same second.
Platform / version applicability
Windows execution, automation and observability
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformWindows execution, automation and observability
Scope / prerequisiteUse this when choosing what starts a scheduled task.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Triggers can be time, event, logon or startup.
  • One task can have several triggers.
  • Triggers can expire.
Key checks
  • Get-ScheduledTask -TaskName <name> | fl * — task definition
  • Get-ScheduledTaskInfo -TaskName <name> — last run time and result
  • schtasks /query /tn <name> /v /fo list — details in CMD
  • Get-WinEvent -LogName Microsoft-Windows-TaskScheduler/Operational -MaxEvents 30 — task history (enable first)
ReferenceWhy it matters1 section · depth on demand

Trigger types

TriggerExample
TimeOnce, daily, weekly, monthly
At startupBefore user logon
At logonAny or specific user
On idleAfter idle period
On eventSpecific event ID in a log
On workstation lock/unlock, session connectUser session events

Event triggers are useful for reacting to failures (e.g. run a script on event 7034 service crash).

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Scheduled task triggers:

TriggerExample
Time / daily / weeklyNightly maintenance
At startupService-like jobs (runs before logon)
At logonPer-user scripts
On idleDefragmentation-style work
On an eventReact to event ID (e.g. 4625 failed logons)
On session connect/lockRDS scenarios
$t = New-ScheduledTaskTrigger -Daily -At 02:00
$t2 = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName Cleanup -Trigger $t,$t2 -Action (New-ScheduledTaskAction -Execute powershell.exe -Argument '-NoProfile -File C:\Scripts\cleanup.ps1') -User SYSTEM -RunLevel Highest
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Commands

$t = New-ScheduledTaskTrigger -Daily -At 02:00 -RandomDelay (New-TimeSpan -Minutes 30)
$a = New-ScheduledTaskAction -Execute powershell.exe -Argument '-NoProfile -File C:\Scripts\job.ps1'
Register-ScheduledTask -TaskName NightlyJob -Trigger $t -Action $a -User SYSTEM -RunLevel Highest

Documented example, not captured output.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docWindows execution, automation and observability current

Authoritative/upstream documentation reviewed for bounded claims in Task Scheduler → Triggers. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page · confidence 94%
Confirmation

Confirm action

Continue?