views:

413

answers:

2

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.

A: 

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

leppie
Well, I'm sure you're right.But in the Task Scheduler setup it says it's running as Administrator and I've checked the box which says 'Run with Highest Privelages'
Here is the xmlhttp://www.mediapreviewer.com/temp/backup.xml
A: 

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.