Server 2008 Task Scheduler Mapped Drive Access C #

I am trying to start the Server 2008 Task Scheduler to run a C # console application that backs up data to a mapped backup drive somewhere on the FastHosts network.

I wrote a test application that just does it

Directory.CreateDirectory ("Z: \" + DateTime.Now.Ticks.ToString ());

i.e. just creates a directory at the root of this Z drive.

This works fine when I just run .exe, but when I schedule it in the task scheduler, it does not create a directory, but says that the task is completed with return code 3762507597. - I can not find any information about what this means.

I am performing the task with the highest administrator privileges as far as I can see.

+4
source share
3 answers

If this ever helps someone else, the problem I am facing is related to an “action” requiring the “Start” path to be set to the same path as the application itself. Otherwise, I assume that he is trying to write to the system root.

A little mysterious!

+5
source

I don’t know why it works now, but I replaced the displayed drive letter, that is, “Z”, with the full name ie \ [IP address]] \ C $, and now it works.

Some strange permissions have no doubt.

+2
source

This looks like an AccessViolationException , so I assume that you are not working under the correct credentials.

+1
source

Source: https://habr.com/ru/post/1306796/


All Articles