How to Trigger Tasks from System Events in Windows 11

Automating tasks in Windows 11 based on specific system occurrences is an effective way to maintain system health, run backups, or trigger custom scripts. By combining the diagnostic logging of the Windows Event Viewer with the automation engine of Task Scheduler, you can instruct your computer to execute a program or script the exact moment a specific Event ID or source log is registered. This guide provides a straightforward, step-by-step walkthrough to identify target system events and configure custom scheduled tasks triggered by those events.


Step 1: Identify the Target Event Details

Before creating your scheduled task, you need the specific identifier for the event you want to use as a trigger.

  1. Press Win + R, type eventvwr.msc, and press Enter to open the Event Viewer.
  2. In the left sidebar, expand Windows Logs and select the category relevant to your trigger (such as System, Application, or Security).
  3. Locate the event you want to use as a trigger and click on it.
  4. Note the following three details from the event summary:
    • Log Name (e.g., System)
    • Source (e.g., Kernel-Power, Disk, or Service Control Manager)
    • Event ID (e.g., 1074 for a system shutdown/restart)

Step 2: Create a Custom Task in Task Scheduler

Using the full “Create Task” wizard allows you to fine-tune permissions, triggers, and actions.

  1. Press Win + R, type taskschd.msc, and press Enter to open Task Scheduler.
  2. In the right-hand Actions pane, click Create Task….

General Tab

Triggers Tab

  1. Click the Triggers tab, then click New….
  2. Open the Begin the task drop-down menu and select On an event.
  3. Choose the Basic setting and specify the event details identified in Step 1:
    • Log: Select the corresponding log (e.g., System).
    • Source: Select the exact source name from the list.
    • Event ID: Type the numerical Event ID.
  4. (Optional) For advanced scenarios involving specific event data, switch the radio button to Custom and click New Event Filter… to build complex XML queries.
  5. Click OK.

Actions Tab

  1. Click the Actions tab, then click New….
  2. Set Action to Start a program.
  3. In the Program/script field, click Browse… to select your executable, batch file (.bat), or script (.ps1).
    • If running a PowerShell script, enter powershell.exe in the program box, and add -ExecutionPolicy Bypass -File "C:\Path\To\YourScript.ps1" into the Add arguments box.
  4. Click OK.

Conditions and Settings Tabs


Step 3: Verify and Test the Task

  1. In Task Scheduler, select Task Scheduler Library from the left pane and find your newly created task in the central list.
  2. In the right-hand pane, click Enable All Tasks History to ensure future executions are logged.
  3. Simulate or wait for the system event to occur.
  4. Refresh Task Scheduler and check the Last Run Result column or the History tab at the bottom to confirm that your event successfully triggered the task.