Task scheduler runs console app task only for the first time - windows

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.

Related

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

Returning and reporting on multiple return codes in SCCM package

I have a utility that detects pending restarts and prompts the user to restart. It also forces a restart on Sunday at 2AM if needed. I'd like to be able to report on who did what:
Ignored restart prompt (automatically goes away after 2 hours)
Clicked the "Later" button
Clicked the "Restart now" button
Computer Auto-restarted
I can send the different return codes from my Powershell script, but I don't know how I would setup the package to accept multiple return codes and report on it. I've found some documentation on MIF files, but it all seems to apply to older versions of SCCM - I'm running ConfigMgr 1910 and I'm good at SQL reporting, just need to get the data into a table somewhere.
Maybe this git project can help you to send the information via custom status messages:
https://github.com/MattiasC85/Send-CMMessage

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.

how to close running process (Chrome) from task manager in Ubuntu

while working on application, code execution caught in infinite loop like-
console.log('print');
and now it is running and running.
To close Chrome I tried everything which I can but no result.
finally I restart my machine to solve it, that took several minutes
The same (infinite looping) happen again and again, I looked for that like -
http://ubuntuhandbook.org/index.php/2013/07/use-ctrl-alt-del-task-manager-ubuntu/
Advanced Scheduled Process/Task Manager - Linux
Killing a process in linux
finally I got solution, wanted to share with all to save the time-
Here is the solution-
1. Machine info-
Ubuntu 16.04 LTS.
Press windows Butoon-
type 'System Monitor', which will display one menu, click on that-
We will see list of all running process as-
At bottom, we have button as 'end process', click on that which will show one popUp as-
click Ok and that task enjoy!!!
Hope will work for you too!!

How do I start a background task from a VisualStudio post-build event?

I'm trying to start an instance of grunt watch whenever a particular project is run from VisualStudio. I have a single page-app written in ember, and compiled with grunt, which connects to a backend written with WebAPI. I'm trying to reduce friction so it's possible to Start Debugging (F5) in VS and have it get everything up and going.
If I add a post-build event to compile the app with grunt, it works fine:
node node_modules\grunt-cli\bin\grunt dev --no-color
grunt watch never terminates, so the VisualStudio build appears to hang until you terminate the node.exe process (which is mostly expected, other than not being able to use Ctrl+Break to stop in VS):
node ../node_modules\grunt-cli\bin\grunt watch --no-color
I've tried starting with the start command, but VisualStudio still waits for it to exit (just saying "Build started..."):
start node ../node_modules\grunt-cli\bin\grunt dev --no-color
I've also tried with start's /i parameter, but that doesn't help. It opens a new window running grunt watch, but the build doesn't continue (and the app doesn't start) until I close the console window.
Presumably this has something to do with the process being a child of the build process? Is there an actual way to start a background task without VisualStudio waiting on it?
Not sure why exactly start doesn't do the trick (works perfectly from the command line), but afaik msbuild spawns a seperate cmd process for it's build events so it will have something to do with that.
A working alternative is to use Powershell to start the process instead. No idea about the builtin powershell syntax, but invoking C#'s Process.Start works just as fine:
powershell -Command "[System.Diagnostics.Process]::Start( '/path/to/node', 'args' )"
That answers your question, however I think it's not what you really want, and you're asking the wrong question.. You say you want to 'start an instance whenever a particular project is run from VisualStudio', but then you go on asking about build events which occur when a project is built. That is different and seems unhandy since every single build will start a new instance. Instead, I think what you actually want/need is to start an instance everytime you start debugging your project. That's also possible as laid out here:
add an empty project to your solution
enter your node command under the projects' Properties->Debugging
right-click solution, select Set Startup Project
select Multiple startup projects
set Action to Start for your main project
set Action to Start without debugging for the empty project
Now hit F5 and VS will start node, plus start debugging your project.

Resources