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

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 10706
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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: stevenkblack | last post by:
I want to have a script that checks that my databases are up and running. I just want the scrip to connect to several databases and check the count of a certain table. I want this script to run...
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,...
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). ...
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...
3
by: Donald A. Fisher | last post by:
Hello. I've been working a vb project and have a form with a button on it that performs some actions after disabling the button when clicked: Code disabling button and starting actions: Private...
0
by: dhaval0011 | last post by:
How to Enable/Disable a task from task scheduler -------------------------------------------------------------------------------- Hi, Does anyone know some code that will allow me to enable...
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...
1
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
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.