Creates Scheduled Jobs in Windows Task Scheduler
Creates & Manages Scheduled Jobs in Windows Task Scheduler.
When user says any of these:
Schedule a jobSchedule a taskCreate scheduled taskCreate scheduled jobAdd scheduled jobAdd a reminderCreate a reminderCreate a reminder recurring reminderRemind me to do certain task atRemind:Reminder:Schedule:You should perform these steps:
In this step, you would see if the type of scheduled task/job user wants to do can be performed by you. For example, you can perform these tasks:
You would check if you have right tools available to perform above tasks and approve and proceed to Step 2 below. However if user says:
You would reject it because you realize you dont gmail tool for example. In these cases, inform user that scheduled job cannot be created and why.
Let's assume user said Reminder: pickup my friend at 11:00AM then you would prepare some metadata that will extract prompt, time schedule, task_name and is_recurring:
Pickup your friend11:00AMAgent Tasks - PickupFriendfalseCreate a powershell script that will actually create scheduled task in Windows Task Scheduler. Based on above example, it would create a script something like:
$action = New-ScheduledTaskAction `
-Execute "powershell.exe" `
-Argument "-ExecutionPolicy Bypass -File \"[full path to agent.ps1]\" -prompt \"Pickup your friend\" -taskname \"Agent Tasks - PickupFriend\" -delete 1"
$trigger = New-ScheduledTaskTrigger `
-Once `
-At (Get-Date "2026-01-20T11:00:00")
Register-ScheduledTask `
-TaskName "Agent Tasks - PickupFriend" `
-Action $action `
-Trigger $trigger
That would save action something like powershell.exe -ExecutionPolicy Bypass -File full\path\to\agent.ps1 -prompt "Reminder: pickup my friend at 11:00AM".
Above powershell snippet is just an example to give you idea but actual script can differ based on job frequency.
Critical Rules You Must Follow Always:
agent.ps1 script must be used. First ensure file exists at path and use that path.C:\Users\USER\AppData\Local\Temp\) folder only and executed from there. -RunLevel Highest in script.Once only for one-time tasks only.scripts directory.Agent Tasks prefix to all created jobs as shown in example earlier. So TaskName must always be like Agent Tasks - [actual title here].delete argument to agent.ps1 script would be 1 if job is NOT recurring and 0 if job is recurring.prompt, taskname and delete param to agent.ps1 script.\n identifiers.powershell.exe -ExecutionPolicy Bypass -File "full\path\to\agent.ps1" -prompt "Reminder: pickup my friend at 11:00AM". For delete, keep it without any quotes as in delete 1.Execute the script created in step 3. If some error, edit it and try executing again. Repeat this (max of 5 attempts) until there is no error.
Verify scheduled task was actually created in Windows Task Scheduler.
If task successfully created in Windows Task Scheduler, show a success notification with .\notify.ps1 -title "Success" -content "Task was scheduled successfully!" -icon "success". Otherwise in case of error or unable to create task, show error notification instead with .\notify.ps1 -title "Error" -content "Unable to create scheduled task!" -icon "error".
When user says any of these:
List all scheduled tasksList all my scheduled tasksList all scheduled jobsList all my scheduled jobsList all remindersList all my remindersList all schedulesList all my schedulesYou would then look for all tasks that have Agent Tasks prefix in them and list them. If no tasks, inform user accordingly.
When user says any of these:
Delete scheduled taskDelete scheduled jobDelete reminderDelete scheduleYou would then look for all tasks that have Agent Tasks prefix and list them for user with numberd list. When user replies with a number, you would go ahead and delete that job and verify it was actually deleted.
Show a success/error notification based on if job was deleted.
If no tasks, inform user accordingly.
We can also show warning and info notifications as needed:
.\notify.ps1 -title "Information" -content "This is an informational message." -icon "info".\notify.ps1 -title "Warning" -content "This is a warning message." -icon "warning"