By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,086 Members | 1,442 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,086 IT Pros & Developers. It's quick & easy.

Enable / Disable scheduled task using vb.net

P: n/a
Does anyone know some code that will allow me to enable and/or disable a task
which already exists in the task scheduer. I have a task which runs at 15 min
intervals and from time to time I want to disable (and later enable) that
task. I'd like to do so programatically as part of another application
instead of opening the task scheduler and right clicking on the relevant task.

Any guidance or suggestions for code would be appreciated

Regards

Michael Bond
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <4D**********************************@microsoft.co m>, mabond wrote:
Does anyone know some code that will allow me to enable and/or disable a task
which already exists in the task scheduer. I have a task which runs at 15 min
intervals and from time to time I want to disable (and later enable) that
task. I'd like to do so programatically as part of another application
instead of opening the task scheduler and right clicking on the relevant task.

Any guidance or suggestions for code would be appreciated

Regards

Michael Bond


Michael...

You can grap a copy of my wrapper for the task scheduler...
http://www.mtogden.com/~tom/files/Sc...gAgent.NET.zip

--
Tom Shelton [MVP]
Nov 21 '05 #2

P: n/a
In article <4D**********************************@microsoft.co m>, mabond wrote:
Does anyone know some code that will allow me to enable and/or disable a task
which already exists in the task scheduer. I have a task which runs at 15 min
intervals and from time to time I want to disable (and later enable) that
task. I'd like to do so programatically as part of another application
instead of opening the task scheduler and right clicking on the relevant task.

Any guidance or suggestions for code would be appreciated

Regards

Michael Bond


I better give a little more explanation. If you grab the file, what you
get is a C# project. This project compiles to a .NET dll that wraps the
task scheduler's com interfaces. There are other similar libraries out
there as well... Any way, just include the project in your solution and
reference it from your vb projec and you should be able to do something
like:

Dim ts As New TaskScheduler
Dim tsk As Task = ts ("MyTask")

tsk.Disabled = true ' disable the task

ts.Dispose ()
HTH
--
Tom Shelton [MVP]
Nov 21 '05 #3

P: n/a
ok Tom

thanks for the help ... it's appreciated

Regards

Michael Bond

"Tom Shelton" wrote:
In article <4D**********************************@microsoft.co m>, mabond wrote:
Does anyone know some code that will allow me to enable and/or disable a task
which already exists in the task scheduer. I have a task which runs at 15 min
intervals and from time to time I want to disable (and later enable) that
task. I'd like to do so programatically as part of another application
instead of opening the task scheduler and right clicking on the relevant task.

Any guidance or suggestions for code would be appreciated

Regards

Michael Bond


I better give a little more explanation. If you grab the file, what you
get is a C# project. This project compiles to a .NET dll that wraps the
task scheduler's com interfaces. There are other similar libraries out
there as well... Any way, just include the project in your solution and
reference it from your vb projec and you should be able to do something
like:

Dim ts As New TaskScheduler
Dim tsk As Task = ts ("MyTask")

tsk.Disabled = true ' disable the task

ts.Dispose ()
HTH
--
Tom Shelton [MVP]

Nov 21 '05 #4

P: n/a
Tom

My Tech support staff have disabled C# on my .NET installation .... because
"they do not support it" ...... I cannot compile the project ..... and I
cannot convince my Tech support to enable C# (despite the fact they are not
being asked to support it) ...... any further suggestions

Michael

"Tom Shelton" wrote:
In article <4D**********************************@microsoft.co m>, mabond wrote:
Does anyone know some code that will allow me to enable and/or disable a task
which already exists in the task scheduer. I have a task which runs at 15 min
intervals and from time to time I want to disable (and later enable) that
task. I'd like to do so programatically as part of another application
instead of opening the task scheduler and right clicking on the relevant task.

Any guidance or suggestions for code would be appreciated

Regards

Michael Bond


I better give a little more explanation. If you grab the file, what you
get is a C# project. This project compiles to a .NET dll that wraps the
task scheduler's com interfaces. There are other similar libraries out
there as well... Any way, just include the project in your solution and
reference it from your vb projec and you should be able to do something
like:

Dim ts As New TaskScheduler
Dim tsk As Task = ts ("MyTask")

tsk.Disabled = true ' disable the task

ts.Dispose ()
HTH
--
Tom Shelton [MVP]

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.