0

I have a scheduled task that is supposed to run an application located in a server.

The access to the server is only allowed to a specific user, so in order to be able to execute such application, or even browse the contents of the specified application's path, you need to login using user credentials. These credentials have been added to the Windows Credentials Manager as Windows Credentials.

Having credentials already stored, I can easily access the folder where the application is located and I can even execute it there myself with no trouble.

The problem happens when the application is supposed to be executed by the scheduled task. When the triggers run the task, it can't find the specified path and ends with the exit code 0x80070002.

I find this problematic because if I go to the task scheduler and manually run the task, which runs the application in the server, it works out fine, it runs the application and exits with code 0x0, this without changing anything to the credentials configuration. This also fixes itself when I visit the application's path in the server.

The scheduled task's triggers are supposed to run the application hourly, however once it has failed it keeps failing every hour, but if it ran fine, it will keep running fine every next hour.

The server's path is defined by an IP address, not by domain.

This usually happens only after turning on the computer for the first time of the day, if it has started working it will work even if I restart the computer.

Other scheduled task's settings:

  • Run only when the user is logged on.
  • Trigger: Hourly.
  • Action: Start a program.
  • Condition: Start as long as its connected to any network.
  • Allow task to be run on demand.
  • Stop the task if it runs longer than 5 minutes
  • If the running task does not end when requested, force it to stop.

What could possibly be causing this behaviour? Why does it not work when the task is ran by the scheduler?

  • Not sure exactly, but are you allowed to tick the box for "run as highest privileges"? Also, the user running, if not a domain admin, may need to be set in the GPO under the "run as batch" user list. One more thing, does any interaction happen on a network drive? Sometimes when booting back up, a computer doesnt connect to mapped drives so you should only use full UNC paths for example \\computer3\sharedDrive\test. Also, make the sure the sccript itself does not reference a mapped drive and uses UNC paths – Narzard Mar 6 '18 at 23:35
  • I forgot to mention but yes the Run with the highest privileges is ticked. The drive is not mapped, the path is as follows: \\#.#.#.#\folder\app. I'm not sure about that specific aspect of this user's GPO, I will have to check that tomorrow. – user1676874 Mar 6 '18 at 23:43
  • Is the user specified in When running the task, use the following user account: the same user that has permission to run the application? – Twisty Impersonator Mar 7 '18 at 0:31
  • @TwistyImpersonator: Yes. – user1676874 Mar 7 '18 at 0:47
  • Is the task running an executable that's stored on a different computer? What's in the box where you specify what program to run? – Twisty Impersonator Mar 7 '18 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.