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?