scripting@wanadoo.nl




atGetJobs()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
24 February 2003 atGetJobs()
AuthorFlorian Lagg, ICQ 167357108
Action get all task scheduler jobs on a local or remote NT/2000/XP-Machine. uses WMI, for NT 4.0 you have to install WMI first.
SyntaxatGetJobs ($sComputer) 
Parameters
  • $sComputer (Required / String) Hostname of remote Computer or " " for localhost 
  • Remarkson NT 4.0 install WMI 
    Returns-1 = error: WMI probably not installed or
    -2 = error: WMI query for scheduled jobs fails or
    an array with all jobs on a specific host. This array has the following properties:

    JobID, Caption, Command, DaysOfMonth, DaysOfWeek, Description, ElapsedTime, InstallDate, InteractWithDesktop, JobStatus, Name, Notify, Owner, Priority, RunRepeatedly, StartTime, Status, TimeSubmitted, UntilTime 
    DependenciesWMI must be installed on NT 4.0
    Win 2000 and XP have it installed 
    Examples
    $Jobs = atGetJobs ("")        ; all Jobs from localhost
    $Jobs = atGetJobs ("server1") ; all Jobs from "server1"
    
     
    Source
    FUNCTION atGetJobs ($scomputer)
      IF ($scomputer = "")
        $scomputer = "." ; (=localhost)
      ENDIF
    
      $objwmiservice = GetObject("winmgmts:"+"{impersonationLevel=impersonate}!\\"+$scomputer+"\root\cimv2")
      IF @error = 0
        $objwmiservice_schedule = $objwmiservice.execquery("Select * from Win32_ScheduledJob")
        IF @error = 0
          $atgetjobs = $objwmiservice_schedule
        ELSE
          $atgetjobs = -2
        ENDIF
      ELSE
        $atgetjobs = -1
      ENDIF
      $objwmiservice = 0
    ENDFUNCTION ; - atGetJobs -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter