473,385 Members | 1,338 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,385 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 4540
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.