disable task

103 views
Skip to first unread message

hzol...@gmail.com

unread,
Feb 22, 2018, 1:15:20 PM2/22/18
to Task Scheduler Managed Wrapper
Hi,

I'm trying to execute this code:
        Try
            Using tService As New TaskService
                Dim tTask As Task = tService.GetTask("MES Import")
                If Not tTask Is Nothing Then
                    tTask.Enabled = False
                    tTask.RegisterChanges()
                End If
            End Using
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        Finally
            Console.WriteLine("Press any key to exit")
            Console.ReadKey()
            End
        End Try

I expected it should disable task called "MES Import". But nothing happens. No error message...

majbla...@gmail.com

unread,
Mar 12, 2018, 4:31:49 PM3/12/18
to Task Scheduler Managed Wrapper
could you add an "Else" branch to see if the issue is just it's not finding the Task?
Reply all
Reply to author
Forward
0 new messages