creating a scheduled task

Home Forums Scripting General Scripting creating a scheduled task

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    ntwaddell
    Member
    #128418

    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..

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\” _
    & strComputer & “rootcimv2”)
    JobID = “Recon”

    Set objNewJob = objWMIService.Get(“Win32_ScheduledJob”)
    errJobCreate = objNewJob.Create _
    (“c:reconrecon.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[/CODE][CODE] strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\” _
    & strComputer & “rootcimv2”)
    JobID = “Recon”

    Set objNewJob = objWMIService.Get(“Win32_ScheduledJob”)
    errJobCreate = objNewJob.Create _
    (“c:reconrecon.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[/CODE]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.