Loading

exec scheduled task

  1. <%
  2. Sub RunJob
  3.     Dim objTaskService, objRootFolder, objTask
  4.  
  5.     'create instance of the scheduler service
  6.     Set objTaskService = Server.CreateObject("Schedule.Service")    
  7.    
  8.     'connect to the service
  9.     objTaskService.Connect            
  10.  
  11.     'go to our task folder, use just "\" if you saved it under the root folder
  12.     Set objRootFolder = objTaskService.GetFolder("\WebTasks\")    
  13.     'reference our task
  14.     Set objTask = objRootFolder.GetTask("IIS_Task")            
  15.  
  16.     'run it
  17.     objTask.Run vbNull                
  18.     vMsg = "Submitted"
  19.    
  20.     'clean up
  21.     Set objTaskService = Nothing    
  22.     Set objRootFolder = Nothing
  23.     Set objTask = Nothing
  24. End Sub
  25.  
  26. %>

Comments