Windows Server 2012 R2 Task Scheduler access denied (0x80070005), but command works manually in shell

batch-filepermissionswindowswindows-server-2012-r2

I have the following problem. On our Windows Server 2012 R2 is a scheduled task which calls a batch file, which in return calls vb scripts.

Those scripts just download 5 pictures and stores them into a folder under a specified name. If I call the bat directly via command line, it works like a charm but with the scheduler I get following information.

It saves the files in the same partition where the script is located. Just in another folder where the user also has access, because he is added to the admin group.

Event Information: Event-ID: 201  ResultCode 2147943645 successfully completed

The ResultCode seems to match the following access denied message.

Result of the last execution: Access denied 0x80070005

My researches lead me to try some config changes.

  • Run the task in the Schedule with highes rivileges -> same error

  • Change the security for %windir%/system32/cmd.exe -> user already in
    the admin group

  • Remove " from start in -> there is nothing, also adding the
    folder, where the script is located doesn't change anything

Thank you in advance for any hint, question, information to this problem.

Best Answer

I think that should check Task Security Context of your schedulled task.

Do you have store user's password in the task?

The error can be caused by lack of network access.