• Why didn’t my task happen?

    Tags:

    Author
    Topic
    #2315221

    I’m looking at the task scheduler window and it has my task listed:  3:58AM, 11/17, one time.   I entered the task yesterday morning.  But… the task didn’t happen.  It says it is enabled and all the fields are correct.  But 3:58 came and went this morning and it didn’t run and I can’t figure out why not.  This with win10 2004.   Are there other things I need to do to make the task “go” beyond the simple settings for a “basic task”?

    Viewing 10 reply threads
    Author
    Replies
    • #2315222

      11/17 was 10 days ago, not this morning. Is the task set for 11/10 or 11/27?

    • #2315224

      11/17 was 10 days ago, not this morning. Is the task set for 11/10 or 11/27?

      Sorry — I mistyped — it was, indeed, scheduled for 11/27. [this morning]

    • #2315226

      You need to refresh the task view for changes to be visible.
      What is the “last result”?

      cheers, Paul

    • #2315247

      Did you check the box run whether logged in or not? Also, one thing I noted with Win10 is you can’t import a task created in 7 or 8. You have to create it again manually in 10. That was a pain for me.

    • #2315415

      I’ve attached the entry from the scheduler that I found this morning.   I noticed that it had a “last run time” of the right time and the last run result is (0x1).   Its settings are “run only when user is logged in” .  Trigger one time  The action is “shutdown” with arguments /r/f. no conditions.

      task

    • #2315431

      Looks like I’ve found the problem:  0x1 is an *error* code.  So the scheduler tried to run my task and it failed.  The only thing I can figure is that perhaps it can’t find “shutdown” — it runs just fine from an unprivileged winkey-R.    It must be that the PATH when running task manager isn’t the normal PATH.   SO.. for tonight’s try I’m going to try specifying a full path.  So I did

      c: cd windows
      dir /s shutdown.exe

      and I found four copies of it:
      system32
      syswow64
      WinSxS\amd64_microsoft-windows-shutdown-event-tracker_31bf3856ad364e35_10.0.19041.1_none_b8c5253467557e69
      WinSxS\wow64_microsoft-windows-shutdown-event-tracker_31bf3856ad364e35_10.0.19041.1_none_c319cf869bb64064

      I’m guessing that the system32 one is the right one nor winsxs [[whatever *that* is].  So I’ll edit the “program” to be c:\system32\shutdown and I bet it’ll run tomorrow morning.

      I wonder what the PATH in task scheduler is.   I guess I can do a time batch file:
      echo %PATH% >d:\desktop\taskpath.txt
      and see what I get.

       

    • #2315435

      I did the experiment and I see that the PATH variable for tasks is the same as the normal PATH variable.   I can only assume/guess that task scheduler doesn’t use the PATH variable to find the program to run….   I’ll know more tomorrow morning when/if my task, at last, runs

      • #2315521

        Look in the properties of the task (specifically, the “Settings” tab) to see if it can be manually run (“Allow task to be run on demand” check box is checked). If so, then run it by using the “Run” command with the green arrow next to it on the right side of the Task Manager window.

        Doing so will allow you to see the “results” sooner than tomorrow morning. Sounds like if you’re successful, you’ll have to push the power button to start your computer because of the “shutdown” command you’ve mentioned.

        If you can run it manually as stated above, let us know what the results are by posting back here.

        • #2315546

          Two things: first, I’ll do that tomorrow morning *IF* the batch file doesn’t run tomorrow morning.  I’m busy this evening and don’t want to reboot my system.

          I *think* I got the command right: /r/f ought to force the shutdown and reboot.  So I’m hoping to see my system up, but having been restarted tomorrow.  I’m betting that putting the full path on shutdown will have fixed it.

      • #2315522

        If you put your commands in a batch file, you can test it. Once you confirm it works, have your task run the batch file.

        • #2315548

          I could do that but.. if my guess [about need the full path to the program to run] is correct then that wouldn’t help:  I already know that running “shutdown” directly from a command prompt or a batch file works [on my {slow} laptop I have a “hibernate.bat” file that just does “shutdown /h” and it works perfectdly.

          So I think that that’s the other way to deal with this problem: just make a one-line batch file [shutdown /r/f] and run *that* from task scheduler.   The nice part about doing it that way is that I won’t have to remember the proper path and switches for shutdown:  I can create “restart.bat” and whenever I need to reboot the system schedule *that* for 3AM.

          • #2315570

            just make a one-line batch file [shutdown /r/f] and run *that* from task scheduler.

            Yes, that’s what I am suggesting.

    • #2315611

      There is no need to use the full path for shutdown, it works from anywhere.

      Why are you rebooting the PC at 4 in the morning?
      My PCs only reboot after patching / major problems and these are very rare.

      cheers, Paul

    • #2315647

      I’m rebooting overnight because I run stuff on my PC pretty close to 24 hrs a day.  The “down time” is generally between 2AM and 6AM.  And the  thing got a 0x1 error again last night.  I’ll try it again with a batch file.

      • #2315830

        Change the task to run something like Notepad. Then you can see if the task runs or if the command fails.

        cheers, Paul

    • #2315659

      I just tested a few times and it works fine on my Win10 system.
      On the general tab check “run with highest privileges” You may want to run whether logged on or not.
      On the actions tab – Start a program – type in shutdown – in add arguments type /r /f

    • #2315877

      Mystery solved!!   I made a batch file:

      echo System Restarted >d:\restart.log
      shutdown /r /f 2>&1 >>d:\restart.log

      and when it didn’t work I looked at the log and it gave me the answer [actually fixed , as above] and it then worked perfectly.   The solution: shutdown won’t accept concatenated arguments.  I really thought you could do that and so my original stuff used “shutdown /f/r” and that throws an error!   when I put a space between the arguments [as above] it all worked.

    Viewing 10 reply threads
    Reply To: Why didn’t my task happen?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: