VBScript for WMI listing of scheduled tasks?

Discussion in 'Scripting' started by Jason, Sep 10, 2008.

  1. Jason

    Jason Guest

    I'm trying to list the scheduled tasks on a Win Server 2008 64-bit machine.
    But running the following script produces no results (or errors):

    strComputer = "."

    set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
    for each objJob in colScheduledJobs
    MsgBox objJob.Name
    next
     
    Jason, Sep 10, 2008
    #1
    1. Advertisements

  2. Jason

    Masterplan Guest

    Hi Jason,

    The Win32_ScheduledJob WMI class represents a job created with the AT
    command. The Win32_ScheduledJob class does not represent a job created with
    the Scheduled Task Wizard from the Control Panel. That's why it produce no
    results.
     
    Masterplan, Sep 11, 2008
    #2
    1. Advertisements

  3. Jason

    Jason Guest

    Thank you.

    And is there a WMI class (or other script-accessible class) with which I can
    list the jobs created via the Scheduled Task interface?
     
    Jason, Sep 11, 2008
    #3
  4. Jason

    Masterplan Guest

    Hi again,

    I didn't find such a specific class. I used a time ago schtasks /query to do
    this.
     
    Masterplan, Sep 11, 2008
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.