469,356 Members | 1,965 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Enable / Disable scheduled task using vb.net

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
4 10243
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
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
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
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.

Similar topics

5 posts views Thread by A. Lovhaug | last post: by
1 post views Thread by stevenkblack | last post: by
6 posts views Thread by John Bowman | last post: by
1 post views Thread by satelite | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.