40

As Ryan Ries pointed out, 2147942402 translates to "File not Found" - which is a very appropriate response. Try and press Win+R, put in "move" and press enter - that's the interactive equivalent of what your task is failing to do. The reason is that MOVE is not a program, but a native command in cmd. It should be: Program: "cmd.exe" Arguments: "/c move C:\...


31

Figured out how to do it myself. It's somewhat of a workaround but that's what I expected to get. Alright, first step is to grab a program called AutoLogon.exe from Microsoft: http://technet.microsoft.com/sv-se/sysinternals/bb963905.aspx Stop! Don't cringe just yet. Read on... Run it, set it so that Administrator should log on automatically. Create a task ...


25

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"


17

I have a program that is launched on system startup using Task Scheduler on Windows Server 2012. The program must start even if the computer reboots automatially. Then why do you not make it a system service, as the windows specs define? How can I solve this? You can not. Background programs are not supposed to interact with the UI. Or: the UI should ...


16

I have no authoritative reference but I have just tested the behavior of multiple different Stop conditions in Task Scheduler on both Windows 8.1, Server 2008 R2 and 2012 R2. They both apply! Whichever stop condition is met first, stops the task. Per trigger stop condition: The Stop task if it runs longer than-condition specified in the Trigger will only ...


15

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 I was able to issue the service stop command with no problem sc stop schedule


15

The shutdown command itself has a delay parameter /t that delays a shutdown for a number of seconds up to 10 years. If you want to schedule a shutdown in 14 hours, say, you might run shutdown /r /t 50400 You might also add a reason with the /d parameter or a comment with /c; run shutdown /? for details.


14

Proper scheduling of future tasks by local time, taking into account time zones and daylight saving time, is a very complex subject. I've written about it before from a programming perspective on Stack Overflow here and here. I'll summarize from a non-programming perspective: Define your recurrence patterns by local time - not UTC. For example, if you ...


14

You can use the COM-based Task Scheduler Scripting objects: ($TaskScheduler = New-Object -ComObject Schedule.Service).Connect("localhost") $MyTask = $TaskScheduler.GetFolder('\').GetTask("My Task") $MyTask.Enabled = $false To enable the task again: $MyTask.Enabled = $true The above will only work if the shell is elevated and you are a local Administrator ...


14

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-pavić More explanations with these links : https://crontab.guru/#0_8___1-5 https://crontab.guru/#0_8___1,2,3,4,5 The use of >/dev/null 2>&1 is ...


14

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, which is how most tasks I have seen run. It appears that .Net Core console app needs to run with the optional path so it can find the appsettings.json if you are ...


13

The default working directory for a scheduled task running as the Local System account is %Windir%\System32\ Source: I just tested it by making a scheduled task, running as SYSTEM, that executed a batch file. The batch file contained the line ipconfig > test123.txt. When the scheduled task is run, the test123.txt file appears in the Windows\System32 ...


10

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 will. That said, you need the running user password (that you have) Compared to Weasly's suggestion, it just skips the export phase. create a second task using ...


9

If you disable a task while it is running it does not stop the current execution, the current process will continue to run until it finishes. Just all next scheduled executions will be disabled. If you run a task manually and don't want it to start again automatically while your manual run is still processing, you can setup the task to apply the rule "do ...


8

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\scripts\SetDNS.ps1; exit $LastExitCode}" > C:\ProgramData\ORGNAME\scripts\SetDNS.log $LastExitCode has the exit code of the your script, you have to bubble ...


7

I believe your problem has to do with either the permissions of the account being used to run the task, or the context of the account as exists when trying to run the task. Test for Console Session Requirement It's possible your .EXE must be run in Console session (aka Session 0) on the computer. To test for this: Configure the task to Run only when user ...


7

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.


6

I reported this bug to Microsoft last year, via our 3rd party support company. They acknowledged it as a bug, but refused to fix without a high business impact - I was hacking something in development at the time. In my research I discovered that the correct profile will be used if you have an interactive session running as the user your scheduled task is ...


6

We just noticed the same issue on our production servers (also Windows Server 2012), which occurred this week. It also started after our clocks went back one hour (which was November 3, 2013, here in Toronto). Update as at Nov 12, 2013: Rebooting did not work (tasks continued to run twice) Exporting and re-importing the tasks did not work (tasks continued ...


6

Create the task and set it to start ONCE in the past. The task will exist and you can run it at will.


6

Go into Task Scheduler (taskschd.msc). While there, there's a button on the right menu for Display All Running Tasks. I think this is what you want. While you're there, you should turn on Enable All Tasks History, so you could track something like this better in the future.


6

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. This way the development site will only be one day behind and any changes made to the data will be overwritten every evening Below are the outlined steps ...


6

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.


6

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 this technet blog post: Help! My Scheduled Task does not run…


5

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=777] /f Then you can run it on demand: SCHTASKS /Run /TN "TaskOnEvent" Or trigger it by logging the event: EVENTCREATE /ID 777 /L APPLICATION /T INFORMATION /...


5

If you're just trying to stop ALL of the tasks, it may be easier to just stop the Task Scheduler service. The ScheduledTasks Module isn't available until Windows Server 2012, so managing tasks isn't as straightforward as stopping and starting a service: Stop-Service Schedule Start-Service Schedule If that doesn't work for you schtasks.exe can still be used ...


5

If it's something running through the task scheduler, you can look at the Event Logs to see what ran during that time. It will be fairly verbose, so you will need to filter out regular occuring events, but it might help you drill down on the issue. Event Viewer -> Application and Security Logs -> Microsoft -> Windows -> Task Scheduler -> Operational should ...


5

Use cURL in a script and set it to be run via scheduled task. You don't have to set the authorization header manually, you can just use the --user argument curl --user user:pass http://www.example.com If you really want to add the header manually use the -H / --header switch. More on that here. curl -H "Authorization: [auth string]" http://www.example....


5

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. I was given a target date of release of the patch for July/August. This affects both Windows 10 and Server 2016. My test systems were patched through to ...


5

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.


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