0

I had Task Scheduler start a task at 11:55 PM daily -- same setup on 5 servers.

Last night I changed the same job to be run at 2 AM and 7 AM instead.

It did not launch either. I know because it starts a .bat file that writes to a log with date stamp. The logs are not there.

When I go to Properties->History, it reports that Task Started,Task Completed both at 2 AM and 7 AM.

Right-click->RUN caused it to run immediately, and the log files appeared.

It was running nightly before, so obviously all the security settings, "run when user is logged out" (although I was not logged out), etc, should be correct.

Anything I am missing?

Are there known Task Scheduler reliability issues?

I am using Windows Server 2012 R2. Thank you.

3
  • The task running and the task action running aren't the same thing. What does the task history show?
    – joeqwerty
    Feb 26, 2016 at 17:13
  • 7am - Created Task Process, Task Started, Action Started, 7:00:01 - Action completed, Task completed
    – Muposat
    Feb 26, 2016 at 17:25
  • Everything on History looks exactly the same as when it was running for real
    – Muposat
    Feb 26, 2016 at 17:28

1 Answer 1

0

The issue was with the timestamp:

set datestamp=%date:~-4%.%date:~-10,-8%.%date:~-7,-5%_%time:~0,2%.%time:~3,2%.%time:~6,2%
echo %datestamp%
start /b "" cmd /c job_name.exe arg1 arg2 arg3 ^> nightly_%datestamp%.log 2^>^&1

In the AM Windows prepends a space to the time stamp:

2016.02.29_ 9.57.02
nightly_2016.02.29_ 9.57.02.log

which is not acceptable as a file name. I corrected the issue by adding a line that replaces space with underscore:

set datestamp=%datestamp: =_%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .