Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delete all scheduled jobs on a machine

0 views
Skip to first unread message

Julian

unread,
Feb 23, 2005, 6:26:25 AM2/23/05
to
Can anyone provide me with some sample c# code for deleting all
scheduled jobs on a machine?

Thanks

Willy Denoyette [MVP]

unread,
Feb 23, 2005, 7:39:19 AM2/23/05
to
Use Process.Start to start schtask.exe.
...
Process.Start(schtasks.exe", "/delete /tn * /f")
...

Willy.

"Julian" <julian....@morganstanley.com> wrote in message
news:1109157985....@g14g2000cwa.googlegroups.com...

Julian

unread,
Feb 23, 2005, 10:20:16 AM2/23/05
to
Thanks Willy -

I was thinking of using something like the Win32_ScheduledJob class but
this seems to work. Is there anyway I could check for a return type to
ensure the deletion works?

Julian

Willy Denoyette [MVP]

unread,
Feb 23, 2005, 11:09:59 AM2/23/05
to

"Julian" <julian....@morganstanley.com> wrote in message
news:1109172016.0...@z14g2000cwz.googlegroups.com...

Yes, call WaitForExit and get the Exit code, Exit 0 means success all else
means failed.
Win32_ScheduledJob can only be used with jobs created by Win32_ScheduledJob,
if this is your case you can query all jobs and delete each individual using
the JobId.

Willy.


0 new messages