28 votes
Accepted

How to schedule a task to call a URL

Use the Invoke-WebRequest cmdlet from Powershell. In your task: Action: Start a program Program/script: powershell.exe Arguments: -Command "Invoke-WebRequest http://myapp/BackgroundTask/Run"
  • 16.6k
16 votes

.NET Core console app fails from task scheduler with 0xC0000005

I searched and tried all kinds of solutions and the one that worked for me was to set the Start In option. Normally someone could have the full path in the Program/Script text box after browsing, ...
15 votes
Accepted

How do you restart the Task Scheduler service without rebooting the server?

The only way I could stop this service without rebooting the server was to run a command prompt using the service account. Do this I used PsExec from Sysinternals psexec -i -s cmd In the new window ...
  • 308
14 votes

Ubuntu cron job every workday

These syntaxes are valid for all working days a 8:00 AM : 0 8 * * 1-5 /path/to/command >/dev/null 2>&1 0 8 * * 1,2,3,4,5 /path/to/command >/dev/null 2>&1 as you said @aleksandar-...
10 votes

How do I rename a task in Task Scheduled on Windows Server 2008 R2

Not the best way but can be a life saver. Tasks are stored in C:\Windows\System32\Tasks in XML format importable using schtasks.exe. As Weasly told, renaming the file doesn't work but Create/Delete ...
  • 201
9 votes

Task scheduler scheduled task at startup not working

I struggled a while with the same problem. In my case, the problem was the setting "Start the task only if the computer is on AC power".
8 votes
Accepted

How do I create a scheduled task that will run as the logged in user

If you run Task Scheduler as Administrator, the option to Change User or Group will be available. There you can set the task itself to run as a non-privileged group.
8 votes
Accepted

Scheduled task runs with exit code 0, but powershell script is not always executed

I think the exit code task scheduler is reporting is for running powershell.exe not your script. Try changing it to this: -ExecutionPolicy Bypass –NoProfile –Command "& {C:\ProgramData\ORGNAME\...
8 votes

powershell scheduled task always shows running even once completed

Just a tiny note: If you run a task manually it will go to "running" in task scheduler library. Wait until your task finishes and then hit F5 to refresh.
  • 181
7 votes

schtasks - create task with no schedule that runs on demand

Instead of using a dummy time in the past or future, you can set the task to run on a dummy event: SCHTASKS /Create /TN TaskOnEvent /TR notepad.exe /SC ONEVENT /EC Application /MO *[System/EventID=...
7 votes

What is the best way to run cronjob in AWS ECS?

I'm not familiar with Laravel or Artisan but essentially you'll need to: create a container image with your job (artisan) create a task definition that runs the artisan container when invoked create ...
  • 24.2k
6 votes

"The user account does not have permission to run this task"

I think you can go to C:\Windows\System32\Tasks folder. There find your job folder and finally your job file. Right click and select Properties -> Security -> Advanced (Button) -> Owner (Tab) ...
  • 169
6 votes
Accepted

Back up a database nightly

Back up a database nightly I have a development database that I would like to refresh with the data from the Production database. I would like for this to happen every evening if possible. ...
6 votes

Register-ClusteredScheduledTask : The parameter is incorrect

I was able to resolve this issue by choosing a different task name. I have seen this under two circumstances: I have a scheduled task that has become corrupt. Even deleting it won't free up the task ...
6 votes

Powershell Script will run but screen capture not completed, why?

Your problem is that by choosing "runs whether user is logged on or not", you're basically telling the task to run in session 0 which is not your logged on desktop. More detailed info is available in ...
  • 16.6k
5 votes

Windows Server 2016 scheduled task schedule must be in future

FYI - I have confirmed with Microsoft through a support ticket I opened yesterday that this is a bug. The support tech confirmed it is internally classified as a bug and a patch is being developed. ...
5 votes
Accepted

Windows Task Scheduler deletes batch file upon running it

It turned out to be Avast detecting the scripts as viruses and deleting them. It had to be configured to allow the .CMD files to be run by Task Scheduler.
  • 1,373
5 votes

Ubuntu cron job every workday

Finally tested and found the answer, so 1-5, or MON-FRI does not work, what works is 0 8 * * 1,2,3,4,5 /path/to/command
5 votes
Accepted

Can scheduled task actions run in parallel?

The official documentation says : Be aware that when multiple actions are specified, they are executed sequentially. There are no official ways to change this behavior, however, you can create ...
  • 6,435
4 votes

Why is Windows Task Scheduler trying to launch multiple instances?

This is the issue described in KB2617046: if you disable and then enable a scheduled task, duplicate triggers are created. The task properties still shows only one trigger, but you can see that the ...
  • 141
4 votes

Linux: Schedule command to run once after reboot (RunOnce equivalent)

I think this answer is the most elegant: Place script in /etc/init.d/script and self-delete with last line: rm $0 Unless the script is 100% fail-proof, probably wise to handle exceptions to avoid a ...
  • 173
4 votes
Accepted

Task Scheduler with Virtual Accounts, possible?

You can't run it as a virtual user account. But you can run it with a virtual group account. (But since that that "group" has a 1:1 relationship with the task, it effectively is a user). ...
  • 5,231
4 votes
Accepted

Store scheduled tasks in user profile

The Windows Task Scheduler has no provisions to do what you're asking for in its stock functionality. You'd need to look to third-party software or, as you say, trying to put something together ...
4 votes
Accepted

windows scheduled task is killed (timed out) too soon

The Trigger ExecutionTimeLimit has priority over the Task ExecutionTimeLimit. <ExecutionTimeLimit>PT20H</ExecutionTimeLimit> If both are specified, the Task time limit is ...
  • 34.7k
4 votes
Accepted

powershell scheduled task always shows running even once completed

Even though the script was doing everything it was configured to it seems I needed to place all of the arguments inside quotes. Old arguments (everything completed fine but task hung): -...
  • 61
4 votes
Accepted

GPO not applied, gpresult /R OK -- scheduled task not created

Found the issue. Used this : https://support.microsoft.com/en-us/help/2447414/user-gpp-scheduled-task-item-fails-to-apply-and-logs-event-id-4098-with-0x80070005-access-is-denied. To avoid this ...
  • 125
4 votes

Task scheduler scheduled task at startup not working

You are executing this Task with "VM" user privileges. Does "VM" account have "Run as a batch Job" rights? How are you setting up your scheduled task, through local Task Scheduler or through DC GPO ...
  • 281
4 votes

PowerShell script running from scheduled task: action failed to start, directory name invalid

Use the following syntax to run a PowerShell script in task scheduler: Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Add arguments: -NoLogo -Noninteractive -Noprofile -...
  • 3,344
4 votes

How to run a script on a server 1 minute after a commit has been made?

Write a git post-commit hook that contains a call to at time+60
  • 360
4 votes
Accepted

If two scheduled tasks are missed, in which order will they run next?

The order is not specified, it's an implementation detail. So you can't rely on the execution order, because it can be random, or change with Windows updates. You have two options here: Disable Run ...
  • 6,435

Only top scored, non community-wiki answers of a minimum length are eligible