Changes one or more of the following properties of a task.
Syntax
schtasks /change /tn
TaskName [/s Computer [/u [Domain\]User [/p Password]]] [/ru {[Domain\]User | System}] [/rp Password] [/tr TaskRun] [/st StartTime] [/ri Interval] [{/et EndTime | /du Duration} [/k]] [/sd StartDate] [/ed EndDate] [/{ENABLE | DISABLE}] [/it] [/z]
Parameters
-
/tn
TaskName
-
Identifies the task to be changed. Enter the task name.
-
/s
Computer
-
Specifies the name or IP address of a remote computer (with or without backslashes). The default is the local computer.
-
/u [Domain\]User
-
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 specified user account must be a member of the Administrators group on the remote computer. The /u and /p parameters are valid only for changing a task on a remote computer (/s).
-
/p
Password
-
Specifies the password of the user account specified in the /u parameter. If you use the /u parameter, but omit the /p parameter or the password argument, Schtasks prompts you for a password.
The /u and /p parameters are valid only when you use /s.
-
/ru {[Domain\]User | System}
-
Specifies to change the user account under which the task runs. For specifying the Local System account, valid entries are "", "NT AUTHORITY\SYSTEM", or "SYSTEM".
When you change the user account, you must also change the user password. If a command has an /ru parameter but not an /rp parameter, schtasks prompts for a new password.
Tasks run with permissions of the local system account do not require or prompt for a password.
-
/rp
Password
-
Specifies a new password for the existing user account, or the user account specified by the /ru parameter. This parameter is ignored with used with the local system account.
-
/tr
TaskRun
-
Changes the program that the task runs. Enter the fully qualified path and file name of an executable file, script file, or batch file. If you omit the path, schtasks assumes that the file is in the systemroot\System32 directory. The specified program replaces the original program run by the task.
-
/st
Starttime
-
Specifies the start time for the task, using the 24-hour time format, HH:mm. For example, a value of 14:30 is equivalent to the 12-hour time of 2:30 PM.
-
/ri
Interval
-
Specifies the repetition interval for the scheduled task, in minutes. Valid range is 1 - 599940 (599940 minutes = 9999 hours).
-
/et
EndTime
-
Specifies the end time for the task, using the 24-hour time format, HH:mm. For example, a value of 14:30 is equivalent to the 12-hour time of 2:30 PM.
-
/du
Duration
-
Specifies to close the task at the EndTime or Duration, if specified.
-
/k
-
Stops the program that the task runs at the time specified by /et or /du. Without /k, Schtasks does not start the program again after it reaches the time specified by /et or /du, but it does not stop the program if it is still running. This parameter is optional and valid only with a MINUTE or HOURLY schedule.
-
/sd
StartDate
-
Specifies the first date on which the task should be run. The date format is mm/dd/yyyy.
-
/ed
EndDate
-
Specifies the last date on which the task should be run. The format is mm/dd/yyyy.
-
/ENABLE
-
Specifies to enable the scheduled task.
-
/DISABLE
-
Specifies to disable the scheduled task.
-
/it
-
Specifies to run the scheduled 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 or tasks that already have the interactive-only property set. You can not use a change command to remove the interactive-only property from a task.
By default, the "run as" user is the current user of the local computer when the task is scheduled or the account specified by the /u parameter, if one is used. However, if the command includes the /ru parameter, then the "run as" user is the account specified by the /ru parameter.
-
/z
-
Specifies to delete the task upon the completion of its schedule.
-
/?
-
Displays help at the command prompt.
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 does not have interactive logon rights. Users do not see and cannot 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 a task runs
The following command changes the program that the Virus Check task runs from VirusCheck.exe to 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 cannot change the task name.)
schtasks /change /tn "Virus Check" /tr C:\VirusCheck2.exe
In response, SchTasks.exe displays the following success message:
SUCCESS: The parameters of the scheduled task "Virus Check" have been changed.
As a result of this command, the Virus Check task now runs VirusCheck2.exe.
To change the password for a remote task
The following command changes the password of the user account for the RemindMe task on the remote computer, Svr01. 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.
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 does not run.
schtasks /change /tn RemindMe /s Svr01 /rp p@ssWord3
In response, SchTasks.exe displays the following success message:
SUCCESS: The parameters of the scheduled task "RemindMe" have been changed.
As a result of this command, the RemindMe task now runs under its original user account, but with a new password.
To change the program and user account for a task
The following command changes the program that a task runs and changes the user account under which the task runs. Essentially, it uses an old schedule for a new task. This command changes the ChkNews task, which starts Notepad.exe every morning at 9:00 A.M., to start Internet Explorer instead.
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 /rp parameter, which provides the password for the user account, is omitted. You must provide a password for the account, but you can use the /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.
schtasks /change /tn ChkNews /tr "c:\program files\Internet Explorer\iexplore.exe" /ru DomainX\Admin01
In response, SchTasks.exe requests the password for the user account. It obscures the text you type, so the password is not visible.
Please enter the password for DomainX\Admin01:
Note that the /tn parameter identifies the task and that the /tr and /ru parameters change the properties of the task. You cannot use another parameter to identify the task and you cannot change the task name.
In response, SchTasks.exe displays the following success message:
SUCCESS: The parameters of the scheduled task "ChkNews" have been changed.
As a result of this command, the ChkNews task now runs Internet Explorer with the permissions of an Administrator account.
To change a program to the System account
The following command changes the SecurityScript task so that it runs with permissions of the System account. It uses the /ru "" parameter to indicate the System account.
schtasks /change /tn SecurityScript /ru ""
In response, SchTasks.exe displays the following success message:
INFO: The run as user name for the scheduled task "SecurityScript" will be changed to "NT AUTHORITY\SYSTEM".
SUCCESS: The parameters of the scheduled task "SecurityScript" have been changed.
Because tasks run with System account permissions do not require a password, SchTasks.exe does not prompt for one.
To run a program only when I am logged on
The following command adds the interactive-only property to MyApp, an existing task. 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, I do not need to change the /ru parameter for the task.
schtasks /change /tn MyApp /it
In response, SchTasks.exe displays the following success message.
SUCCESS: The parameters of the scheduled task "MyApp" have been changed.