question

DiazJohnA-6508 avatar image
0 Votes"
DiazJohnA-6508 asked JiaYou-MSFT commented

Windows Server 2016 Scheduled Task Error

Windows Server 2016 scheduled task ends with return code 2147942499. Runs to good EOJ if task is manually run.

windows-server-2016
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered JiaYou-MSFT commented

Runs to good EOJ if task is manually run.

Does that mean that if you right click the task in the Task Scheduler mmc app and select "run", that it executes ok?

Or does that mean that you have defined a task to execute some program or .bat file and when you run it interactively, like from a command prompt, that it executes ok?

If it's the latter, then you need to do basic troubleshooting. What program are you running? What account is the task defined to execute as? Are you capturing stdout and stderr? Does the application itself provide any logging features?

· 15
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Right-click and 'run'.
The application that is running is a home grown implementation of WinSCP that downloads file from a bank. Since it's such a small app, I didn't add any logging or error capture. The task is setup to run as the MSA account for the console app; I'd hoped that the 2147942499 code was really an 'access denied' on the destination folder in disguise, but still not running even after adjusting the permission on the destination folder. Any clue on the 2147942499?

0 Votes 0 ·

Any clue on the 2147942499?

Calc says that -2147942499 is 80070063. I didn't find much on that.

http://openssl.6102.n7.nabble.com/CAPI-Engine-doc-td75246.html
https://www.stunnel.org/pipermail/stunnel-users/2017-February/005720.html

Kinda fits in with a WinSCPish program (SSL related) but if you can right click and run the task, then I would be more suspicious of the task trigger or maybe the time of day that you've got it set to run.

Are you logged on to the desktop when it fails?

Try tracing it with Process Monitor and see if it gets any "access denied" events.

https://docs.microsoft.com/en-us/sysinternals/downloads/procmon


0 Votes 0 ·

No, not logged on when it fails. Remoting into that box and running the task. It could be a time of day thing. Noon could be a popular time for things to happen, and by the time I get notified of the failure and I rerun it's 10-15 minutes later.

0 Votes 0 ·
Show more comments
imamitsingh avatar image
0 Votes"
imamitsingh answered MotoX80 commented

Might want to add a /f to the command line to force the reboot. I don't know if this is the cause of that error, but I've seen where if a user is logged in, the scheduled task wouldn't run. The /f switch forced the reboot regardless.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Nothing in this thread says anything about a reboot or a shutdown command.

Did you reply to the wrong question?

0 Votes 0 ·