Schedule a task in Windows Server from vb.net

0

Good morning,

I am programming a task from vb.net with these parameters. Generates the task correctly and executes. This works correctly in local, but you would need that task to be created on the server. Any ideas?

Using tService As New TaskService()
    Dim Fecha As DateTime = DateTime.Parse(txtFDesde.Text + " " + txtHDesde.Text)
    Dim tTime As New TimeTrigger()
    Dim tDefinition As TaskDefinition = tService.NewTask
    tDefinition.RegistrationInfo.Description = "Tarea programada para ejecutar"
    tDefinition.Settings.RunOnlyIfLoggedOn = False
    tTime.StartBoundary = New DateTime(Fecha.Year, Fecha.Month, Fecha.Day, Fecha.Hour, Fecha.Minute, 0)
    tDefinition.Triggers.Add(tTime)
    Dim url As String = "http://localhost:5000/" & Param
    tDefinition.Actions.Add(New ExecAction("cmd.exe", "/c start " & url))
    tService.RootFolder.RegisterTaskDefinition("Test " & Param, tDefinition)
End Using
    
asked by Sorginah 22.12.2017 в 12:53
source

0 answers