...
SCHTASKS /CREATE /SC DAILY /TN "'The name of my scheduled task'" /TR "'C:\Users\Admin\Documents\Scripts\ScriptToRun.vbs'" /ST 09:00
Warning | ||
---|---|---|
| ||
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 type | Description |
---|---|
MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY | Specifies the time unit for the schedule. |
ONCE | The task runs once at a specified date and time. |
ONSTART | The task runs every time the system starts. You can specify a start date, or run the task the next time the system starts. |
ONLOGON | The 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. |
ONIDLE | The 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}
Value | Description |
---|---|
[<Domain>] | Specifies an alternate user account. |
System or | Specifies 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 type | Modifier values | Description |
---|---|---|
MINUTE | 1 - 1439 | The task runs every <N> minutes. |
HOURLY | 1 - 23 | The task runs every <N> hours. |
DAILY | 1 - 365 | The task runs every <N> days. |
WEEKLY | 1 - 52 | The task runs every <N> weeks. |
ONCE | No modifiers. | The task runs once. |
ONSTART | No modifiers. | The task runs at startup. |
ONLOGON | No modifiers. | The task runs when the user specified by the /u parameter logs on. |
ONIDLE | No 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. |
MONTHLY | 1 - 12 | The task runs every <N> months. |
MONTHLY | LASTDAY | The task runs on the last day of the month. |
MONTHLY | FIRST, SECOND, THIRD, FOURTH, LAST | Use 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 type | Modifier | Day values (/d) | Description |
---|---|---|---|
WEEKLY | 1 - 52 | MON - SUN[,MON - SUN...] | * |
MONTHLY | FIRST, SECOND, THIRD, FOURTH, LAST | MON - SUN | Required for a specific week schedule. |
MONTHLY | None or {1 - 12} | 1 - 31 | Optional 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>
Value | Description |
---|---|
<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
Value | Description |
---|---|
<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.
...