473,320 Members | 1,838 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,320 software developers and data experts.

Start A Scheduled Task From ASP Server

We have a number of scheduled tasks on our IIS server that run daily at some point during the early morning. These tasks run as a specific user that has the correct permissions to perform whatever task (processing SQL so I'm told)

I have been asked if I can setup a page within ASP that a user could logon to with their own credentials (this I can do).

And once logged on be presented with a list of scheduled tasks which they can then restart by clicking a button. The idea is to give them the abiltity to manually run a job, but within giving them the password to the admin account that the sceduled task uses

Does anyone have any thoughts on how this might be done? Would it be as simple as shelling out to the Scheduled Task shortcut and running it

TIA

Coli
Jul 19 '05 #1
4 14639
Colin Steadman wrote:
We have a number of scheduled tasks on our IIS server that run daily
at some point during the early morning. These tasks run as a
specific user that has the correct permissions to perform whatever
task (processing SQL so I'm told).

I have been asked if I can setup a page within ASP that a user could
logon to with their own credentials (this I can do).

And once logged on be presented with a list of scheduled tasks which
they can then restart by clicking a button. The idea is to give them
the abiltity to manually run a job, but within giving them the
password to the admin account that the sceduled task uses.

Does anyone have any thoughts on how this might be done? Would it be
as simple as shelling out to the Scheduled Task shortcut and running
it?

TIA,

Colin


Are you talking about SQL Agent scheduled tasks (jobs)? Or batch jobs
scheduled using the AT command?

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
"Colin Steadman" <an*******@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...


----- Bob Barrows wrote: -----
Are you talking about SQL Agent scheduled tasks (jobs)? Or batch jobs
scheduled using the AT command?

I've just spoken to the customer and asked this question.

The story has changed somewhat. He now says that the job has not yet been setup, and that he's expecting me to do this bit as well (in whatever way I
feel appropriate). A VBScript would be perfect I think. Can I start a
VBScript and have it run in the background with the credentials of a user of
my choice? TIA


Try something like this: ( I don't remember where I got this from)

Dim oScheduler
Dim objTask
Dim objTrigger
Set oScheduler = CreateObject("Scheduler.SchedulingAgent.1")
Dim TaskName

Set objTask = oScheduler.Tasks.Add("CheckRegistrationReminder")
TaskName = "C:\WINNT\system32\wscript.exe """ & "C:\Program
Files\NellieAdmin\" & "CheckRegistrationReminder.vbs """
objTask.ApplicationName = TaskName
objTask.Comment = "blah blah some comment"
objTask.Creator = "Script File"
objTask.WorkingDirectory = "C:\WINNT\system32"

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #3


----- Tom Kaminski [MVP] wrote: -----

"Colin Steadman" <an*******@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
----- Bob Barrows wrote: -----
Are you talking about SQL Agent scheduled tasks (jobs)? Or batch jobs
scheduled using the AT command?
I've just spoken to the customer and asked this question.
The story has changed somewhat. He now says that the job has not yet been

setup, and that he's expecting me to do this bit as well (in whatever way I
feel appropriate). A VBScript would be perfect I think. Can I start a
VBScript and have it run in the background with the credentials of a user of
my choice? TIA


Try something like this: ( I don't remember where I got this from)

Dim oScheduler
Dim objTask
Dim objTrigger
Set oScheduler = CreateObject("Scheduler.SchedulingAgent.1")
Dim TaskName

Set objTask = oScheduler.Tasks.Add("CheckRegistrationReminder")
TaskName = "C:\WINNT\system32\wscript.exe """ & "C:\Program
Files\NellieAdmin\" & "CheckRegistrationReminder.vbs """
objTask.ApplicationName = TaskName
objTask.Comment = "blah blah some comment"
objTask.Creator = "Script File"
objTask.WorkingDirectory = "C:\WINNT\system32"

--
Tom Kaminski IIS MVP
Thanks Tom,

Slight problem with it though. Apparently it needs the task scheduler dll which is only available on Microsoft Site Server 3.0 according to this post:

http://groups.google.com/groups?hl=e...207.126.101.92

Otherwise you get this error:

Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object: 'Scheduler.SchedulingAgent.1'

/ColinsDevArea/tasks.asp, line 46
Any other ideas?

TIA,

Colin
Jul 19 '05 #4
"Colin Steadman" <an*******@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
----- Tom Kaminski [MVP] wrote: -----

Try something like this: ( I don't remember where I got this from)

Dim oScheduler
Dim objTask
Dim objTrigger
Set oScheduler = CreateObject("Scheduler.SchedulingAgent.1")
Dim TaskName

Slight problem with it though. Apparently it needs the task scheduler dll which is only available on Microsoft Site Server 3.0 according to this post:
http://groups.google.com/groups?hl=e...207.126.101.92
Otherwise you get this error:

Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object: 'Scheduler.SchedulingAgent.1'

/ColinsDevArea/tasks.asp, line 46
Any other ideas?


I think WMI might be the way to go, I was able to find this:
http://msdn.microsoft.com/library/de...heduledjob.asp

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Greg D. Moore \(Strider\) | last post by:
Ok, I thought this one would be easy. I have a stored proc: master.dbo.restore_database_foo This is on database server B. Database server A backs up database foo on a daily basis as a...
6
by: Iain Hosking | last post by:
I am running a SQL Server 2000 installation with several databases. Each database and log is backed-up using a maintenance plan. The scheduled maintance plan for the latest database does not run,...
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,...
2
by: Bob Cummings | last post by:
Greetings I am working on a Senior Project for school. It is a simple ASP.NET on line card catalog for an in-house library. One of the requests the client has is to send an email reminder to...
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,...
4
by: RSH | last post by:
I have an application that creates an Access version of a SQL Server database and then it moves the resulting database to an ftp server for the client to download and run reports against etc. The...
3
by: Steve | last post by:
Here is what I want to do. Currently I have to log into 30 servers every morning and see if all the jobs under 'scheduled tasks' ran. Is there a way from .NET to read that directory for the selected...
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...
2
by: thj | last post by:
Hi, Is it possible to start an scheduled task on a server from ASP.NET? Thanks in advance. Tommy.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.