Task keeps repeatedly running when triggered from a different tasks completion - taskscheduler

I am trying to attach a task (B) to run after the completion of another task (A), which I got to work using windows built in feature by right clicking an event and attaching a task to it. However, task B keeps running repeatedly after successfully completing its own task and never stops. The trigger to run task B is upon task A's log with event 102 (also tried 201 and it didn't help).
I've tried to find an option to stop after completing the task once (which is how I think it should be by default), but can't find anything. I haven't been able to find any relevant posts to this problem, only posts referring to their task not running.
For testing, I'm making task A run a batch file to download a file using WinSCP scripting then task B runs a batch file that runs a python script to create a file. I am using windows 10 home edition if it matters.

The problem was that the trigger for task B wasn't triggering for only task A's 102 event code, but for any 102 event code (including its own), so it kept running the task over and over. I used these sources to create task B manually 1 2. When I first tried to create the tasks manually, the task I wanted to run was in a sub-directory, but I didn't include the directory in the task name, so it didn't work. If you want to find the directory your task is in, then you have to go to the events properties, details, then xml view. From there scroll to the bottom and use the path given from the <Data Name="TaskName"> field.
<QueryList>
<Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
<Select Path="Microsoft-Windows-TaskScheduler/Operational">*[EventData [#Name='TaskSuccessEvent'][Data[#Name='TaskName']='\Sub-directory\taskA']]</Select>
</Query>
</QueryList>

Related

Task scheduler runs console app task only for the first time

I created console app in .Net technology. App works fine when I trigger it by click on exe setup (console shows up for about 5-6 min and that's how it should work), so I put it into Task Scheduler(Windows Server 2022) as a Task with settings:
1.General: Administrator, Run only when user is logged on.
2.Triggers: one time at xxx after trigerred repeat every 15 min, enabled.
3.Actions: Start a program with start in optional parameter (where exe file is).
4.Conditions: none checked.
5.Settings: allow on demand, do not start a new instance.
When I run it from windows explorer task runs properly for the first time. On the next start it stops running. Nothing happens. No errors/unusual results in history. Status changes to Running for 2-3 sec and get back to Ready. if I run it again from the explorer level, task runs properly again, but only for the first time.
What I've tried:
1.Change user (system, local service, network service, administrator).
2.Run logged in and not logged in.
3.Highest priviliges on/off.
4.Every kind of trigger time option.
5.With and without optional start in.
6.Different locations(desktop, C:/, other).
7.Run as Admin in .exe properties.
8.Every checkbox on/off in settings.
Anyone faced this issue? Thanks in advance.

Windows 10 Task Scheduler tasks don't even try to run

I am trying to get a task in windows scheduler to run every 10 mins.
In the following image there are two blue lines, this is only one task but I have screenshot them at different times after refreshing the page.
As you can see in the image Task Scheduler, on the bottom blue line under last run time it says 3:37pm and next run time is 5:02pm. then on the top blue line I have a screenshot the same task after 5:02pm, it hasn't updated the last run time but it has pushed the next run time forward 10 mins.
If I right mouse click on the task and manually run it, it works. Its just the timer functionality of task scheduler that isn't working, I'm guessing i have misconfigured it somehow.
These are the options I have set, everything else is on it's default value.
Trigger
Daily
Recur every 1 day
Start today
Repeat task every 10 mins
for a duration of indefinitely
Expire tomorrow
Enabled
Conditions
Do not Start task only on AC
Wake the computer to start the task
Settings
Run task as soon as possible after scheduled start is missed
My question, What do I need to change to make this actually run every 10 mins.
Evidence of me searching before posting.
Task Scheduler Not Running Batch File I don't use a start path.
Batch file runs manually but not through Windows 10 Task Scheduler I'm not running over the network but I did elevate privs, even though my program doesn't write any files.
Running PowerShell in Task Scheduler Doesn't mention timer functionality only action functionality.
Task Scheduler failed to start. Additional Data: Error Value: 2147943726 I'm not trying to run while I'm logged out and I'm not getting this error message.
I found that when I changed the 'interval' from 'indefinitely' to '1 day', it started to works

2016 Task Scheduler Only Runs the first action in the list

I have a simple Task Schedule job that runs a program 6 times, sending to it a different Argument each time.
This has been working well for some years, but on 2016 Server it only runs the first action and then it stops.
Any ideas of a fix? I have looked on google for all fixes etc, but they haven't worked and seem to be for 2017 and back
Based on my past experience, this behavior could caused by one of the following:
If your task targets a batch file of an executable file, try to check Windows Task Manager for that file running under "Processes" tab. Select each of your target batch/exe then End Process button. This may have caused by a seemed-to-stuck process but still on "Running" status.
On Task Scheduler, check for your task's "Last Run Result". This could be having code other than 0x0 (which is the successful run). If so, check for details under "History" tab below this pane.

Execute task on Windows startup/shutdown with custom message

I already know a task can be executed on startup or shutdown by defining the path to the desired script in the group policy editor (gpedit.msc) under
Computer Configuration --> Windows settings --> Scripts (Startup/Shutdown).
But how is it possible to show a custom progress message on the Windows startup respectively shutdown screen during task execution? For example Windows Update shows the following message when installing updates
Configuring Windows updates n% complete.
Do not turn off your computer.
Any help is appreciated.

What's the easiest way to make a CC.NET local trigger to execute a program?

When the build fails, I'd like to execute a program that shoots me in the head with this. I've written the program already - I just need it to run when I break the build.
CCTray has the option to make a sound or icon - but not to run a file. Any simple ideas? I'd rather this not be an all day project. :)
CCTray allows you to run commands. In CCTry, go to File | Settings and then click on the Exec tab.
If you run Outlook, you can set up a rule that runs an application whenever you receive an email saying the build is broken. Just follow the rules wizard and you will find it (in Ootlook 2007 it's on the 3rd page of the wizard, in the select action part).
Cradiator has functionality to monitor build servers and do stuff when a build breaks. It doesn't have code to run an executable but it would be a cinch to download the code, change it and get what you want. Here's what I think is the quickest path to getting this done:
Download the source for Cradiator
Edit the DiscJockey.cs class
Add 1 line of code that starts your program (line 34) eg:
Configure Cradiator to monitor your build server (ie edit app.config and add your url) and run
if (newlyBrokenBuilds.Any())
{ // Add a line of code to start your program here eg
Process.Start("C:\\myprogram.exe");
}

Resources