469,601 Members | 2,383 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

Odd Scheduled Task Behavior

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

Jul 21 '05 #1
5 4365
Does the owner of the sceduled task have permissions to access the app? If
the task is running under a different, less-privileged owner, then it might
not be able to run. Is there an error log?

"A. Lovhaug" <Lo***********@coolbits.nu> wrote in message
news:02****************************@phx.gbl...
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

Jul 21 '05 #2
You're probably running under the local system account, and that account has no
network permissions.
--
Phil Wilson [MVP Windows Installer]
----
"A. Lovhaug" <Lo***********@coolbits.nu> wrote in message
news:02****************************@phx.gbl...
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

Jul 21 '05 #3
If by "Owner of the scheduled task" you mean the user
indicated in the "Run as" textbox, then the answer is yes,
they should have permissions to access the app. The user
indicated in the "Run as" textbox is the same user who is
logged in interactively when the commnd script is run
manually.

No, there is no error log entry for this. Perhaps I'll try
to change the audit policy to see if I can view any
additional error information. But that's part of why I'm
mystified - I'm not getting any error information to help
point me.

-----Original Message-----
Does the owner of the sceduled task have permissions to access the app? Ifthe task is running under a different, less-privileged owner, then it mightnot be able to run. Is there an error log?

"A. Lovhaug" <Lo***********@coolbits.nu> wrote in message
news:02****************************@phx.gbl...
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

.

Jul 21 '05 #4
Hmmm. So, if I understand you correctly, you are saying
that a scheduled task that executes a .NET framework
application is running under the local system account,
even if the "Run As" textbox indicates another user? Wow,
that is surprising to me.

If so, it seems to be something unique to running the .NET
application, since running the same XCopy command in a
command script was able to access the network drive fine.
I wonder how I could work around such a limitation?
-----Original Message-----
You're probably running under the local system account, and that account has nonetwork permissions.
--
Phil Wilson [MVP Windows Installer]
----
"A. Lovhaug" <Lo***********@coolbits.nu> wrote in message
news:02****************************@phx.gbl...
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

.

Jul 21 '05 #5
I didn't mean to imply that at all. I'm responding to your original post, and
that doesn't seem to say anything about doing a "run as".
It's nothing to do with .NET, just the case that a process running under the
local system account has no network privileges. If you're using the the "AT
<time>" command, that's a fairly well-known technique for running a process
under the local system account, and that seems to be what's happening here.
--
Phil Wilson [MVP Windows Installer]
----
"A. Lovhaug" <Lo***********@coolbits.nu> wrote in message
news:01****************************@phx.gbl...
Hmmm. So, if I understand you correctly, you are saying
that a scheduled task that executes a .NET framework
application is running under the local system account,
even if the "Run As" textbox indicates another user? Wow,
that is surprising to me.

If so, it seems to be something unique to running the .NET
application, since running the same XCopy command in a
command script was able to access the network drive fine.
I wonder how I could work around such a limitation?
-----Original Message-----
You're probably running under the local system account,

and that account has no
network permissions.
--
Phil Wilson [MVP Windows Installer]
----
"A. Lovhaug" <Lo***********@coolbits.nu> wrote in message
news:02****************************@phx.gbl...
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

.

Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Another DB2 UDB DBA | last post: by
6 posts views Thread by John Bowman | last post: by
5 posts views Thread by A. Lovhaug | last post: by
1 post views Thread by satelite | last post: by
reply views Thread by Myster Edd | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.