- WMI Library -
WMI Libraly > Win32_ScheduledJob Class

Win32_ScheduledJob Class

The Win32_ScheduledJob class represents a job scheduled using the network management schedule service functions (also known as "Job" and "AT command" functions). Note that this is different from the tasks scheduled using the Windows 2000 Task Scheduler. This class is only instrumented on Windows NT 4.0 and later. Each job scheduled against the schedule service is stored persistently (the scheduler will know to start the job even after a reboot) and is executed at the specified time and day of the week and/or month. If the computer is not active or if the scheduled service is not running at the specified job time the schedule service will run the specified job on the next day at the specified time. Scheduled jobs are scheduled with respect to Universal Coordinated Time (UTC), i.e. with bias offset from GMT. This means that a job can be specified using any time zone specification. The Win32_ScheduledJob class will return the local time with UTC offset when enumerating an object and convert to local time when creating new jobs. For example a job specified to run on a computer in Boston at 10:30 pm Monday PST time will be scheduled to run locally at 1:30am Tuesday EST. It should be noted that a client must take into account whether daylight savings time is in operation on the local computer and if so subtract a bias of 60 minutes from the UTC offset.
Namespace value is root/CIMV2.
WMI Provider value is CIMWin32.


Properties

  • Caption
  • The Caption property is a short textual description (one-line string) of the object.

  • Command
  • The Command property contains the name of the command, batch program, or binary file (along with command line arguments) that the schedule service will use to invoke the job.
    Example: defrag /q /f

  • DaysOfMonth
  • The DaysOfMonth property indicates the days of the month when the job is scheduled to run.

  • DaysOfWeek
  • The DaysOfWeek property indicates the days of the week when the job is scheduled to run.

  • Description
  • The Description property provides a textual description of the object.

  • ElapsedTime
  • Length of time that the job has been executing.

  • InstallDate
  • The InstallDate property is datetime value indicating when the object was installed. A lack of a value does not indicate that the object is not installed.

  • InteractWithDesktop
  • The InteractWithDesktop property allows the specified job to be interactive (meaning a user can give input to a scheduled job while it is executing).
    Values TRUE or FALSE. If TRUE, then the job will be interactive. If FALSE, then the job will not be interactive.

  • JobId
  • The JobId property indicates the identifier number of the job. It is used by methods as a handle to a single job being scheduled on this computer.

  • JobStatus
  • The JobStatus property indicates whether a scheduled service executed successfully the last time this job was supposed to run.

  • Name
  • The Name property defines the label by which the object is known. When subclassed, the Name property can be overridden to be a Key property.

  • Notify
  • User to be notified upon job completion or failure.

  • Owner
  • User that submitted the job.

  • Priority
  • Priority indicates the urgency or importance of execution of a job.

  • RunRepeatedly
  • The RunRepeatedly property indicates whether the scheduled job should run repeatedly on the days that the job is scheduled.
    Values: TRUE or FALSE. If TRUE, then the job is run repeatedly. If FALSE, then the job is run once.

  • StartTime
  • The StartTime property represents the UTC time to run the job, in the form of YYYYMMDDHHMMSS.MMMMMM(+-)OOO, where YYYYMMDD must be replaced by ********. The replacement is necessary because the scheduling service only allows jobs to be configured on a day of the month, day of the week, or run once. A job cannot be run on a specific date.
    Example: ********123000.000000-420 which implies 12:30 pm PST with daylight savings time in effect.

  • Status
  • The Status property is a string indicating the current status of the object. Various operational and non-operational statuses can be defined. Operational statuses are "OK", "Degraded" and "Pred Fail". "Pred Fail" indicates that an element may be functioning properly but predicting a failure in the near future. An example is a SMART-enabled hard drive. Non-operational statuses can also be specified. These are "Error", "Starting", "Stopping" and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is on-line, yet the managed element is neither "OK" nor in one of the other states.

  • TimeSubmitted
  • Time that the job was submitted.

  • UntilTime
  • Time after which the job is invalid or should be stopped.


    Methods

  • Create
  • The Create function submits a job to the operating system for execution at a specified future time and date. This function requires that the schedule service be started at the computer towhich the job is submitted. The method returns an integer value which can be interpretted as follows:
    0 - Successful completion
    1 - Not supported
    2 - Access denied
    8 - Unknown failure
    9 - Path not found
    21 - Invalid parameter
    22 - Service not started
    Other - For integer values other than those listed above, refer to Win32 error code documentation.

  • Delete
  • The Delete method deletes a scheduled job. The method returns an integer value which can be interpretted as follows:
    0 - Successful completion
    1 - Not supported
    2 - Access denied
    8 - Unknown failure
    9 - Path not found
    21 - Invalid parameter
    22 - Service not started
    Other - For integer values other than those listed above, refer to Win32 error code documentation.


    Example WQL

    SELECT * FROM Win32_ScheduledJob
    About this site information

    This contents is created by WMI having class information.
    WMI Environment is Windows Server 2008 R2 Enterprise Edition.

    This link is Microsoft documents for "Managing Windows with WMI".
    That is VB(Visual Basic) scripting sample.
    This link is Microsoft documents for "Advanced Programming Topics in WMI .NET".
    That is VB.net(Visual Basic .net) scripting sample.

    - WMI Library -
    http://library.wmifun.net/

    WMI useful by VB,VB.Net,VC,VC.Net,VC#.Net,VBS(WSH),PowerShell for PC asset management, system monitoring and collecting hardware and software inventory.

    This website is created by Toh.
    Copyright(C) 1997-2016 WMI Fun !!. All rights reserved.
    ^ Go to the top...