Win32_ScheduledJob

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.

Quick Start

Properties

In this WMI class, all WMI properties are read-only. You can only read values but not change them.

Caption

Data type String

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

Command

Data type String

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

Data type UInt32

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

$1=1
$2=2
$3=4
$4=8
$5=16
$6=32
$7=64
$8=128
$9=256
$10=512
$11=1024
$12=2048
$13=4096
$14=8192
$15=16384
$16=32768
$17=65536
$18=131072
$19=262144
$20=524288
$21=1048576
$22=2097152
$23=4194304
$24=8388608
$25=16777216
$26=33554432
$27=67108864
$28=134217728
$29=268435456
$30=536870912
$31=1073741824

$DaysOfMonth = $28 + $12

DaysOfWeek

Data type UInt32

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

$Monday=1
$Tuesday=2
$Wednesday=4
$Thursday=8
$Friday=16
$Saturday=32
$Sunday=64

$DaysOfWeek = $Sunday + $Wednesday

Description

Data type String

The Description property provides a textual description of the object.

ElapsedTime

Data type DateTime

Length of time that the job has been executing.

InstallDate

Data type DateTime

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

Data type Boolean

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

Data type UInt32

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

Data type String

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

Name

Data type String

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

Data type String

User to be notified upon job completion or failure.

Owner

Data type String

User that submitted the job.

Priority

Data type UInt32

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

RunRepeatedly

Data type Boolean

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

Data type DateTime

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

Data type String

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.

'OK','Error','Degraded','Unknown','Pred Fail','Starting','Stopping','Service','Stressed','NonRecover','No Contact','Lost Comm'

TimeSubmitted

Data type DateTime

Time that the job was submitted.

UntilTime

Data type DateTime

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

Methods

Examples

Help and Questions

  Community Content

You are cordially invited to add knowledge to this page. If you have sample code or additional information related to this WMI class, please share it. Use the comment form to send your information. We will edit and incorparate it into the reference library. Thank you!

Please do not use the comment form to submit questions. If you have questions or need assistance, visit our free forum: Help me with WMI.

Content last updated: 2013-12-27 12:20:05 (UTC).

Facebooktwittergoogle_pluspinterestlinkedinFacebooktwittergoogle_pluspinterestlinkedin