text
stringlengths
0
4.23k
<password>
<username>
<password>
<Taskrun>
<systemroot>\System32
<Starttime>
<interval>
<level>
<Endtime>
<duration>
<Startdate>
<Enddate>
Remarks
The /tn and /s parameters identify the task. The /tr, /ru, and /rp parameters specify properties of the task that you can change.
The /ru and /rp parameters specify the permissions under which the task runs. The /u and /p parameters specify the permissions used to change the task.
To change tasks on a remote computer, the user must be logged on to the local computer with an account that is a member of the Administrators group on the remote computer.
To run a /change command with the permissions of a different user (/u, /p), the local computer must be in the same domain as the remote computer or must be in a domain that the remote computer domain trusts.
The System account doesn't have interactive logon rights. Users don't see, and can't interact with, programs run with system permissions.
To identify tasks with the /it property, use a verbose query (/query /v). In a verbose query display of a task with /it, the Logon Mode field has a value of Interactive only.
Examples
To change the program that the Virus Check task runs from VirusCheck.exe to VirusCheck2.exe, type:
schtasks /change /tn Virus Check /tr C:\VirusCheck2.exe
This command uses the /tn parameter to identify the task and the /tr parameter to specify the new program for the task. (You can't change the task name.)
To change the password of the user account for the RemindMe task on the remote computer, Svr01, type:
schtasks /change /tn RemindMe /s Svr01 /rp p@ssWord3
This procedure is required whenever the password for a user account expires or changes. If the password saved in a task is no longer valid, then the task doesn't run. The command uses the /tn parameter to identify the task and the /s parameter to specify the remote computer. It uses the /rp parameter to specify the new password, p@ssWord3.
To change the ChkNews task, which starts Notepad.exe every morning at 9:00 A.M., to start Internet Explorer instead, type:
schtasks /change /tn ChkNews /tr c:\program files\Internet Explorer\iexplore.exe /ru DomainX\Admin01
The command uses the /tn parameter to identify the task. It uses the /tr parameter to change the program that the task runs and the /ru parameter to change the user account under which the task runs. The /ru and /rp parameters, which provide the password for the user account, is not used. You must provide a password for the account, but you can use the /ru and /rp parameter and type the password in clear text, or wait for SchTasks.exe to prompt you for a password, and then enter the password in obscured text.
To change the SecurityScript task so that it runs with permissions of the System account, type:
schtasks /change /tn SecurityScript /ru
The command uses the /ru parameter to indicate the System account. Because tasks run with System account permissions do not require a password, SchTasks.exe does not prompt for one.
To add the interactive-only property to MyApp, an existing task, type:
schtasks /change /tn MyApp /it
This property assures that the task runs only when the run as user, that is, the user account under which the task runs, is logged on to the computer. The command uses the /tn parameter to identify the task and the /it parameter to add the interactive-only property to the task. Because the task already runs with the permissions of my user account, you don't need to change the /ru parameter for the task.
schtasks create
Schedules a task.
Syntax
schtasks /create /sc <scheduletype> /tn <taskname> /tr <taskrun> [/s <computer> [/u [<domain>\]<user> [/p <password>]]] [/ru {[<domain>\]<user> | system}] [/rp <password>] [/mo <modifier>] [/d <day>[,<day>...] | *] [/m <month>[,<month>...]] [/i <idletime>] [/st <starttime>] [/ri <interval>] [/rl <level>] [{/et <endtime> | /du <duration>} [/k]] [/sd <startdate>] [/ed <enddate>] [/it] [/np] [/z] [/f]
Parameters
Parameter
Description
/sc <scheduletype>
Specifies the schedule type. The valid values include:MINUTE - Specifies the number of minutes before the task should run.HOURLY - Specifies the number of hours before the task should run.DAILY - Specifies the number of days before the task should run.WEEKLY Specifies the number of weeks before the task should run.MONTHLY - Specifies the number of months before the task should run.ONCE - Specifies that that task runs once at a specified date and time.ONSTART - Specifies that 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 - Specifies that 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 - Specifies that 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 and must conform to the rules for file names, not exceeding 238 characters. Use quotation marks to enclose names that include spaces. To store your scheduled task in a different folder, run /tn <folder name\task name>.
/tr <Taskrun>
Specifies the program or command that the task runs. Type the fully qualified path and file name of an executable file, script file, or batch file. The path name must not exceed 262 characters. If you don't add the path, schtasks assumes that the file is in the <systemroot>\System32 directory.
/s <computer>
Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.
/u [<domain>]
Runs this command with the permissions of the specified user account. The default is the permissions of the current user of the local computer. The /u and /p parameters are valid only when you use /s. The permissions of the specified account are used to schedule the task and to run the task. To run the task with the permissions of a different user, use the /ru parameter. The user account must be a member of the Administrators group on the remote computer. Also, the local computer must be in the same domain as the remote computer, or must be in a domain that is trusted by the remote computer domain.
/p <password>
Specifies the password of the user account specified in the /u parameter. If you use the /u parameter without the /p parameter or the password argument, schtasks will prompt you for a password. The /u and /p parameters are valid only when you use /s.
/ru {[<domain>]<user> | system}
Runs the task with permissions of the specified user account. By default, the task runs with the permissions of the current user of the local computer, or with the permission of the user specified by the /u parameter, if one is included. The /ru parameter is valid when scheduling tasks on local or remote computers. The valid options include:Domain - Specifies an alternate user account.System - Specifies the local System account, a highly privileged account used by the operating system and system services.
/rp <password>
Specifies the password for the existing user account, or the user account specified by the /ru parameter. If you don't use this parameter when specifying a user account, SchTasks.exe will prompt you for the password next time you sign in. Don't use the /rp parameter for tasks that run with System account credentials (/ru System). The System account doesn't have a password and SchTasks.exe doesn't prompt for one.
/mo <modifiers>
Specifies how often the task runs within its schedule type. The valid options include:MINUTE - Specifies that the task runs every <n> minutes. You can use any value between 1 - 1439 minutes. By default, this is 1 minute.HOURLY - Specifies that the task runs every <n> hours. You can use any value between 1 - 23 hours. By default, this is 1 hour.DAILY - Specifies that the task runs every <n> days. You can use any value between 1 - 365 days. By default, this is 1 day.WEEKLY - Specifies that the task runs every <n> weeks. You can use any value between 1 - 52 weeks. By default, this is 1 week.MONTHLY - Specifies that the task runs every <n> months. You can use any of the following values:A number between 1 - 12 monthsLASTDAY - To run the task on the last day of the monthFIRST, SECOND, THIRD, or FOURTH along with the /d <day> parameter - Specifies the particular week and day to run the task. For example, on the third Wednesday of the month.ONCE - Specifies that the task runs once.ONSTART - Specifies that the task runs at startup.ONLOGON - Specifies that the task runs when the user specified by the /ru parameter logs on.ONIDLE - Specifies that the task runs after the system is idle for the number of minutes specified by the /i parameter
/d DAY[,DAY...]
Specifies how often the task runs within its schedule type. The valid options include:WEEKLY - Specifies that the task runs weekly by providing a value between 1-52 weeks. Optionally, you can also add a specific day of the week by adding a value of MON - SUN or a range of [MON - SUN...]).MONTHLY - Specifies that the task runs weekly each month by providing a value of FIRST, SECOND, THIRD, FOURTH, LAST. Optionally, you can also add a specific day of the week by adding a value of MON - SUN or by providing a number between 1 - 12 months. If you use this option, you can also add a specific day of the month, by providing a number between 1-31.NOTE: The date value of 1 - 31 is valid only without the /mo parameter, or if the /mo parameter is monthly (1 - 12). 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. The valid options include JAN - DEC and * (every month). The /m parameter is valid only with a MONTHLY schedule. It's required when the LASTDAY modifier is used. Otherwise, it's optional and the default value is * (every month).
/i <Idletime>
Specifies how many minutes the computer is idle before the task starts. A valid value is a whole number from 1 to 999. This parameter is valid only with an ONIDLE schedule, and then it's required.