Delete Scheduled Task

PPPersia

Newcomer
Joined
Mar 9, 2010
Messages
3
Hi,
I wanna delete all scheduled tasks that starts with a certain string, for example delete all scheduled tasks that their name start with "My Application Task".
I need to do it via a VBScript code!
I found a code but didn't test it:
Visual Basic:
Dim SchedulesID As Integer
Dim strComputer As String
Dim objService As Object
Dim objNewJob As Object
SchedulesID = 1: strComputer = "."
Set objService = GetObject("winmgmts:\\" & strComputer)
If SchedulesID Then
    Set objInstance = objService.Get ("Win32_ScheduledJob.JobID=" & SchedulesID)
    objInstance.Delete
End If
But I don't know how to change it so delete by name?
Anyone can help me do it since I am not very familiar with VBScript?
Thank you :)
 
Back
Top