469,289 Members | 2,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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 14012
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Iain Hosking | last post: by
5 posts views Thread by A. Lovhaug | last post: by
2 posts views Thread by Bob Cummings | last post: by
6 posts views Thread by John Bowman | last post: by
3 posts views Thread by Steve | last post: by
2 posts views Thread by thj | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.