473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 4541
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Another DB2 UDB DBA | last post by:
DB2 UDB ESE is running at V8.1 FP5 on 32-bit Solaris 7, single partition. The tools catalog database is on the same instance as everything else. I have not really embraced the DB2 Task Center...
6
by: John Bowman | last post by:
Hi, I have a C# app that needs to launch the "Add Scheduled Tasks" wizard found in the control panel "Scheduled Tasks" applet. I realize that this "applet" really just opens the tasks folder,...
3
by: Lenn | last post by:
Hi, I developed a console .exe application which is going to run on scheduled basis, it will be scheduled to run in Windows Scheduled tasks. Client wants some kind of utility that would help them...
5
by: A. Lovhaug | last post by:
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,...
1
by: satelite | last post by:
Hello, I am writing an exe that is intended to be run via a scheduled task. However, I also need the flexibility to have users run the scheduled task manually (right click task and select run). ...
0
by: Myster Edd | last post by:
I have a strange problem that I think deals with security on SQL 2005. I have a scheduled task that runs on a Windows 2000 machine. It calls a vb script which creates a connection to SQL Server. ...
1
by: Myster Edd | last post by:
I have a strange problem that I think deals with security on SQL 2005. I have a scheduled task that runs on a Windows 2000 machine. It calls a vb script which creates a connection to SQL Server. ...
0
by: Paulson | last post by:
Dear Freinds I want to make a program that acts as a reminder for the users.I need to open up the Scheduled task wizard programmatically.If you type Tasks in the run command the Tasks...
9
by: jdaelhousen | last post by:
I have a bit of a problem I'm hoping someone can shed some light on... I have a VB.Net console application written in VS 2003 that produces a .exe file that now sits on a Windows 2000 server...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.