== Trigger a scheduled task to run after another task completes ==
You'd think there'd be an easy way to do this. There isn't, or at least there isn't an //obvious// easy way to do this. What you need to do is go {nav task properties > Triggers > New... > Begin the task: On an event > radio button to Custom > Edit event filter > check the Edit query manually box > enter the following XML} (assuming the name of the task you want to run this new task after the success of is "MyPriorTask")
```
lang=xml, name=Edit Event Filter | XML tab
<QueryList>
<Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
<Select Path="Microsoft-Windows-TaskScheduler/Operational">
*[EventData[@Name='TaskSuccessEvent'][Data[@Name='TaskName']='\MyPriorTask']]
</Select>
</Query>
</QueryList>
```
I mean, it's very obvious in retrospect, right? 🙄
== schtasks columns ==
Maybe I'm not noticing on first, annoyed glance, but neither [[ https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-query?source=recommendations | Microsoft's official documentation ]] nor [[ https://ss64.com/nt/schtasks.html | ss64 ]] give a list of valid columns to choose from in the output, and the default {nav TaskName > Next Run Time > Status } is too damn basic, so like me you'll probably find yourself needing to choose what columns to return without having an easy list of the options. Here they are:
- HostName
- TaskName
- Next Run Time
- Status
- Logon Mode
- Last Run Time
- Last Result Author
- Task To Run
- Start In
- Comment
- Scheduled Task State
- Idle Time
- Power Management
- Run As User
- Delete Task If Not Rescheduled
- Stop Task If
- Runs X Hours and X Mins
- Schedule
- Schedule Type
- Start Time
- Start Date End Date
- Days
- Months
- Repeat: Every
- Repeat: Until: Time
- Repeat: Until: Duration
- Repeat: Stop If Still Running
Now you can go ahead and get a more filtered view through . . . fuck if I remember this is all so dumb, Windows sux dude