You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Instance configuration
Setting Windows OS scheduled tasks
Copy page
Download PDF
Setting Windows OS scheduled tasks
Task Scheduler is a task scheduling tool in Windows used to create and manage tasks. The scheduled tasks can run automatically based on the trigger conditions you set. To create scheduled tasks for operations, such as regular backups, system maintenance, and automatic script execution, refer to this topic for guidance.​
Prerequisites​
  • The ECS instance status is Running.​
Procedure​
In the example provided in this topic, a Windows Server 2022 Datacenter Edition 64 bit English image is used to create one scheduled task. The task involves actions of restarting the ECS instance at a specified interval and starting the Notepad program each time the server starts.​
Step 1: Create a task for scheduled restarts​
  1. Click the "Windows" icon and then select "Windows System > Run".​
  • ​​​
  1. Enter the following content in the dialog box and click the "OK" button to open the Task Scheduler dialog box.​
  • ​
    taskschd.msc​
    ​
  • ​​​
  1. In the left directory tree, select "Task Scheduler (Local) > Task Scheduler Library".​
  1. In the "Actions" module on the right, click the "Create Task..." button.​
  • ​​​
  1. Create the scheduled task.​
tip​
Below are the parameters necessarily involved. For more parameters, see Task Scheduler for developers.​
  1. In the "General" tab, configure the basic information of the scheduled task as follows.​
  • ​
    Parameter​
    Description​
    Sample value​
    Name​
    Indicates the scheduled task name.​
    Reboot​
    Security options​
    Configure security-related options.​
    • When running the task, use the following user account: Specifies the user account for which to run the task. By default, the currently logged-in account is used. You can change the account based on your needs after clicking the "Change User or Group" button.​
    • If you select Run only when user is logged on, the task runs only when the specified user account is logged in.​
    • If you check the Run with highest privileges option, the highest permissions are granted during the task runtime. This prevents the scheduled task from failing for permission-related reasons.​
    -​
    ​
  • Configuration example:​
  • ​​​
  1. Select the "Triggers" tab, and then configure the task trigger.​
  1. Click the "New..." button to create a new trigger.​
  1. Configure trigger conditions.​
  • ​
    Parameter​
    Description​
    Sample value​
    Begin the task​
    Indicates the trigger condition to start the task. Here, select On a schedule (task is started as scheduled).​
    tip​
    In the example provided in this topic, "On a schedule" is used. For more available trigger conditions, see Task Triggers.​
    On a schedule​
    Settings​
    Configure the task running cycle.​
    • Start: Indicates the time when the task will run for the first time.​​
    • Daily: Indicates the task runs repeatedly at a specified daily interval.​
    tip​
    In the example provided in this topic, the scheduled task runs repeatedly at the same time every day, starting from 8/12/2024 4:40:11 PM. Adjust the time based on your needs.​
    -​
    ​
  • Configuration example:​
  • ​​​
  1. Click the "OK" button to complete the creation.​
  1. Select the "Actions" tab, and then configure the action the scheduled task performs.​
  1. Click the "New..." button to create a new action.​
  1. Configure the action of restarting the server.​
  • ​
    Parameter​
    Description​
    Sample value​
    Action​
    Indicates the action type. Select Start a program.​
    Start a program​
    Settings​
    Specifies action details.​
    • Program/script: Specifies the target program or script. Enter shutdown.​
    • Add arguments (optional): Specifies arguments contained in the script. Enter /r /f /t 0.​
    -​
    ​
  • Configuration example:​
  • ​​​
  1. Click the "OK" button to complete the configuration.​
  • ​​​
  1. In the pop-up window, enter the login password of the user account for which to run the task, and then click the "OK" button to complete creating the task.​
  • ​​​
Step 2: Create a task for program auto-start​
  1. Click the "Windows" icon and then select "Windows System > Run".​
  • ​​​
  1. Enter the following content in the dialog box and click the "OK" button to open the Task Scheduler dialog box.​
  • ​
    taskschd.msc​
    ​
  • ​​​
  1. In the left directory tree, select "Task Scheduler (Local) > Task Scheduler Library".​
  1. In the "Actions" module on the right, click the "Create Task..." button.​
  • ​​​
  1. Create the scheduled task.​
tip​
Below are the parameters necessarily involved. For more parameters, see Task Scheduler for developers.​
  1. In the "General" tab, configure the basic information of the scheduled task as follows.​
  • ​
    Parameter​
    Description​
    Sample value​
    Name​
    Indicates the scheduled task name.​
    OpenNotepad​
    Security options​
    Configure security-related options.​
    • When running the task, use the following user account: Specifies the user account for which to run the task. By default, the currently logged-in account is used. You can change the account based on your needs after clicking the "Change User or Group" button.​
    • If you check the Run only when user is logged on option, the task runs only when the user account for which to run the task is logged in.​
    • If you check the Run with highest privileges option, the highest permissions are granted during the task runtime. This prevents the scheduled task from failing for permission-related reasons.​
    -​
    ​
  • Configuration example:​
  • ​​​
  1. Select the "Triggers" tab, and then configure the task trigger.​
  1. Click the "New..." button to create a new trigger.​
  1. Configure trigger conditions.​
  • ​
    Parameter​
    Description​
    Sample value​
    Begin the task​
    Indicates the trigger condition to start the task. Here, select At log on (login is the trigger condition).​
    tip​
    In the example provided in this topic, "At log on" is used. For more available trigger conditions, see Task Triggers.​
    At log on​
    ​
  • Configuration example:​
  • ​​​
  1. Click the "OK" button to complete the creation.​
  1. Select the "Actions" tab, and then configure the action the scheduled task performs.​
  1. Click the "New..." button to create a new action.​
  1. Configure the action of restarting the server.​
  • ​
    Parameter​
    Description​
    Sample value​
    Action​
    Indicates the action. In the example provided in this topic, select Start a program (action is starting a program).​
    Start a program​
    Settings​
    Specifies action details.​
    Program/script: Specifies the program to run at startup.​
    1. Click the "Browse..." button.​
    1. Select the "notepad" program, and then click the "Open" button.​
    • ​​​
    1. Click the "OK" button to complete the creation.​
    • ​​​
    tip​
    In this example, the Notepad program is automatically started at startup. Change it to the target program or script based on your needs.​
    -​
    ​
  1. Click the "OK" button to complete the configuration.​
  • ​​​
  1. In the pop-up window, enter the login password of the user account for which to run the task, and then click the "OK" button to complete creating the task.​
  • ​​​
Last updated: 2026.06.18 17:49:52