user219313
user219313

Reputation: 237

Server 2008 Task Scheduler Mapped Drive Access C#

I'm trying do get Server 2008's Task Scheduler to run a C# console app which backs up data to a mapped backup drive somewhere on FastHosts network.

I've written a test app which simply does this

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

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

This works fine when I just run the .exe but when I schedule it in Task Scheduler it doesn't create the directory but says the task has completed with return code 3762507597 - I can't find any info on what this means.

I'm running the task with the highest Admin privelages as far as I can see.

Upvotes: 4

Views: 10372

Answers (3)

Chris Godfrey
Chris Godfrey

Reputation: 61

If this ever helps someone else, the issue I had was due to the 'action' needing to have the 'Start in' path set to the same path as the application itself. Otherwise I'm guessing it's trying to write to the system root.

A bit cryptic!

Upvotes: 6

user219313
user219313

Reputation: 237

Not sure why is now works but I replaced the mapped drive letter i.e. 'Z' with the full name i.e. \[IP address]]\C$ and it now works.

Some weird permissions thing no doubt.

Upvotes: 2

leppie
leppie

Reputation: 117250

That looks like an AccessViolationException, so I assume you are not running under the correct credentials.

Upvotes: 1

Related Questions