Announcement

Collapse
No announcement yet.

creating a scheduled task

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • creating a scheduled task

    I am trying to create a scheduled task with a vbs script, and it just names them at1.job at2.job, etc. How do I set the job name? Here is my script..

    Code:
      strComputer = "."
      Set objWMIService = GetObject("winmgmts:" _
          & "{impersonationLevel=impersonate}!\\" _
          & strComputer & "\root\cimv2") 
      JobID = "Recon"
    
      Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
      errJobCreate = objNewJob.Create _
          ("c:\recon\recon.exe", "********143000.000000-420", _
              True , 1 or 2 or 4 or 8 or 16, ,True, JobID) 
      If errJobCreate = 0 Then
          WScript.Echo "Job created successfully: " & VBNewLine _
              & "Recon.exe scheduled to run repeately at 14.30 (2:30 P.M.) PST" & VBNewLine _
              & "on Mon, Tue, Wed, Thu, Fri."
      Else
          WScript.Echo "Job not created. Error code = " & errJobCreate
      End If

  • #2
    Re: creating a scheduled task

    That is not possible by this method.
    Use SCHTASKS.exe instead.
    http://forums.petri.com/showthread.php?t=18639

    http://www.microsoft.com/resources/d....mspx?mfr=true


    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X