A
A. Lovhaug
I have a console application built in the .NET Framework.
This application basically executes an XCopy based on
parameters that I pass to it. I use it for creating
scripts for backing up folders, etc.
All my command scripts utilizing this console application
work fine when they are executed interactively. However,
if they are executed via a scheduled task, they do not
run. Or more precisely, the script seems to execute at the
appropriate time (a command window flashes), but the
folder copies are never created, and the window disappears
way too quickly. There are no errors registered in the
event logs.
I figured it was a security problem (I'm copying to a hard
drive on another computer), so I created a command script
that used the actual XCopy statement that .NET application
generates (and I know it generates it correctly because it
works fine except as a scheduled task). I then scheduled
this new script as a scheduled task. I assumed that there
was some security context problem, and that the XCopy
statement wouldn't work either from a scheduled task.
However, amazingly, it works just fine.
Now I'm trying to figure out what to try next. Is there
anything special that is required to successfully get
a .NET console application to run from a command script
via a scheduled task? FYI - I'm using Windows XP, Visual
Studio 2003 and the .NET Framework 1.1.
Any suggestions would be greatly appreciated.
A. Lovhaug
This application basically executes an XCopy based on
parameters that I pass to it. I use it for creating
scripts for backing up folders, etc.
All my command scripts utilizing this console application
work fine when they are executed interactively. However,
if they are executed via a scheduled task, they do not
run. Or more precisely, the script seems to execute at the
appropriate time (a command window flashes), but the
folder copies are never created, and the window disappears
way too quickly. There are no errors registered in the
event logs.
I figured it was a security problem (I'm copying to a hard
drive on another computer), so I created a command script
that used the actual XCopy statement that .NET application
generates (and I know it generates it correctly because it
works fine except as a scheduled task). I then scheduled
this new script as a scheduled task. I assumed that there
was some security context problem, and that the XCopy
statement wouldn't work either from a scheduled task.
However, amazingly, it works just fine.
Now I'm trying to figure out what to try next. Is there
anything special that is required to successfully get
a .NET console application to run from a command script
via a scheduled task? FYI - I'm using Windows XP, Visual
Studio 2003 and the .NET Framework 1.1.
Any suggestions would be greatly appreciated.
A. Lovhaug