Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

SCHTASKS /CREATE /SC DAILY /TN "'The name of my scheduled task'" /TR "'C:\Users\Admin\Documents\Scripts\ScriptToRun.vbs'" /ST 09:00


Warning
titlequote in parameters

Every parameters with quote should be quoted with double quotes " " and single quote ' ' inside. Otherwise, white space inside your parameter values might be wrongly interpreted



Delete a task (without a confirmation prompt)

SCHTASKS /DELETE /TN "'The name of my scheduled task'" /F


...

Integration within the proVConnect console

...

List of Parameters for SchTasks (from the microsoft documentation)

/sc <ScheduleType>
Schedule typeDescription
MINUTE, HOURLY, DAILY, WEEKLY, MONTHLYSpecifies the time unit for the schedule.
ONCEThe task runs once at a specified date and time.
ONSTARTThe task runs every time the system starts. You can specify a start date, or run the task the next time the system starts.
ONLOGONThe task runs whenever a user (any user) logs on. You can specify a date, or run the task the next time the user logs on.
ONIDLEThe task runs whenever the system is idle for a specified period of time. You can specify a date, or run the task the next time the system is idle.
/tn <TaskName>

Specifies a name for the task. Each task on the system must have a unique name. The name must conform to the rules for file names and must not exceed 238 characters. Use quotation marks to enclose names that include spaces.

...

/RU {[<DOMAIN>] | SYSTEM}

ValueDescription
[<Domain>]Specifies an alternate user account.
System orSpecifies the local System account, a highly privileged account used by the operating system and system services.
/rp <Password>

Provides the password for the user account that is specified in the /ru parameter. If you omit this parameter when specifying a user account, SchTasks.exe prompts you for the password and obscures the text you type.

...

Specifies how often the task runs within its schedule type. This parameter is valid, but optional, for a MINUTE, HOURLY, DAILY, WEEKLY, and MONTHLY schedule. The default value is 1.

/MO <MODIFIER>

Schedule typeModifier valuesDescription
MINUTE1 - 1439The task runs every <N> minutes.
HOURLY1 - 23The task runs every <N> hours.
DAILY1 - 365The task runs every <N> days.
WEEKLY1 - 52The task runs every <N> weeks.
ONCENo modifiers.The task runs once.
ONSTARTNo modifiers.The task runs at startup.
ONLOGONNo modifiers.The task runs when the user specified by the /u parameter logs on.
ONIDLENo modifiers.The task runs after the system is idle for the number of minutes specified by the /i parameter, which is required for use with ONIDLE.
MONTHLY1 - 12The task runs every <N> months.
MONTHLYLASTDAYThe task runs on the last day of the month.
MONTHLYFIRST, SECOND, THIRD, FOURTH, LASTUse with the /d<Day> parameter to run a task on a particular week and day. For example, on the third Wednesday of the month.
/d Day[,Day...] | *

Specifies a day (or days) of the week or a day (or days) of a month. Valid only with a WEEKLY or MONTHLY schedule.

/D DAY[,DAY...] | *

Schedule typeModifierDay values (/d)Description
WEEKLY1 - 52MON - SUN[,MON - SUN...]*
MONTHLYFIRST, SECOND, THIRD, FOURTH, LASTMON - SUNRequired for a specific week schedule.
MONTHLYNone or {1 - 12}1 - 31Optional and valid only with no modifier (/mo) parameter (a specific date schedule) or when the /mo is 1 - 12 (an every <N> months schedule). The default is day 1 (the first day of the month).
/m Month[,Month...]

Specifies a month or months of the year during which the scheduled task should run. Valid values are JAN - DEC and * (every month). The /m parameter is valid only with a MONTHLY schedule. It is required when the LASTDAY modifier is used. Otherwise, it is optional and the default value is * (every month).

...

The valid date formats are listed in the following table. Use the format most similar to the format selected for Short date in Regional and Language Options in Control Panel on the local computer.

/SD <STARTDATE>

ValueDescription
<MM>//Use for month-first formats, such as English (United States) and Spanish (Panama).
<DD>//Use for day-first formats, such as Bulgarian and Dutch (Netherlands).
<YYYY>//Use for year-first formats, such as Swedish and French (Canada).

/ed <EndDate>

Specifies the date on which the schedule ends. This parameter is optional. It is not valid in a ONCE, ONSTART, ONLOGON, or ONIDLE schedule. By default, schedules have no ending date.

...

The valid date formats are listed in the following table. Use the format most similar to the format selected for Short date in Regional and Language Options in Control Panel on the local computer.

TABLE 6

ValueDescription
<MM>//Use for month-first formats, such as English (United States) and Spanish (Panama).
<DD>//Use for day-first formats, such as Bulgarian and Dutch (Netherlands).
<YYYY>//Use for year-first formats, such as Swedish and French (Canada).
/it

Specifies to run the task only when the run as user (the user account under which the task runs) is logged on to the computer. This parameter has no effect on tasks that run with system permissions.

...