Task Scheduler enables you to automatically perform routine tasks on a chosen computer. Task Scheduler does this by monitoring whatever criteria you choose (referred to as triggers) and then executing the tasks when those criteria are met. You can use the Task Scheduler to execute tasks such as starting an application, sending an email message, etc. Tasks can be scheduled to execute in response to these events, or triggers. On how to create a Scheduled task with Windows Admin Center, how to setup Windows server backup and create backup jobs, and how to create Windows Task Scheduler via the command prompt.
To perform these steps via the task scheduler, follow the steps below. Ensure you have your script ready and saved with .ps1 extension.
- Search and launch the Task Scheduler Tool as shown below or
From the Start menu, select Administrative Tools and then Task Scheduler.
This will open up the task scheduler Tool
– Right-click on Task Scheduler or “under Actions”
– Select “Create Task”
This will open up the create task dialog window as shown below.
– On the General Tab, Enter the Task Name
– Enter a description for others to understand what you are doing
– Select “Run whether user is logged on or not”
If this is not selected and the first option is used, the script may not run when a user does not login. We have had a similar issue in the past.
– Ensure to run with the highest privilege (Here you have to evaluate your security need)
Note: If you are using an account with administrative privileges, the default user should be fine. If you are running a Command Prompt or PowerShell command, you can select the Run whether user is logged on or not option to prevent the command window from showing up when the task runs automatically.
- If the task requires elevated privileges, check the Run with highest privileges option.
Navigate to the Trigger Tab as shown below
– Click on New, This will open a window where the trigger can be defined.
Since we are defining this task for Windows update, and maintenance are done just one in a Month, I will perform the following highlighted in red.
You can decide to have the updates installed on a particular day.
– By selecting the Days and from the dropdown menu, you can select a date. When you are done creating the trigger, The following configured trigger will be displayed as shown below
Next. click on the Action tab
This will open a new Action tab as shown below
– Under the “Settings” section, in the “Program/script” field, specify the path for the application (Here you will have to select the script by browsing to the location or copy the script path to this field).
– Optionally enter the “PowerShell.exe” program path needed to run your script. When this is not select, your script cannot run.
Note: If you don't know the path of the app, click the Browse button to find it. Also, if it is a known application like PowerShell or Command Prompt, all you need to do is to specify the file name.
Note: Use the "Action" drop-down menu and select the Start a program option.You can still use the Send an e-mail or Display a message option, but these are deprecated features, which means that they may or may not work because Microsoft is no longer maintaining them. - In the "Add arguments" field, you can specify arguments to run the task with special instructions. E.g., -NoExit -ExecutionPolicy Bypass C:PATHTOSCRIPTfirst_script.ps1. Using the "powershell.exe" command and the above argument, it'll run the script named "first_script.ps1." The argument "-ExecutionPolicy Bypass" ensures that the script runs successfully, and the "-NoExit" argument will prevent the window from closing after running the script.
When this step is complete, it will appear as shown below
Note: You can also edit the Action after it has been created etc.
Next, click on the condition tab as shown above.
– For me, these settings are not applicable, but below is a screenshot of how it looks like 🙂
Also, on the settings tab, all needed
This will prompt you to enter your password as shown below
To view the configured task, click on the “Task Scheduler Library” and
– Search for your configured task on the left pane of the Window.
To test this task, since the date we have configured this task to run is still in the future, we will manually run the task as shown below.
– For more information on how to run, edit, and delete a task using Task Scheduler GUI (taskschd.msc), see the following link.
– Right-click on the task and
– Click on run
In this same manner, the task can be disabled or also from the Actions pane
– Now that you have selected to run your scheduled task, the status will change to running as shown below.
– With the F5 button on your keyboard, you can use this to refresh the states
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.
You can schedule tasks on Windows Server to run a specific thing or script at a given time, once or repeatedly.
This is achieved as follows:
Step 1
Right-click on the start menu and select “Computer Management.”
Step 2
On the left-hand menu, right-click on ‘Task Scheduler’ and select “Create basic task.”
Step 3
Give the task a name and a detailed description of what it does.
Step 4
Please select when you want it to run. The options are Daily, Weekly, Monthly, Once When the computer starts when a user logs in or when a specific event is detected in the event log.
Step 5
Assuming Daily, click next and then set a time and a start date, then you can pick the recurrence. You can now tune this despite selecting daily, so it only runs every three days, for example. Click Next once you have made your selection.
Step 5
Your choices now are: Start a program (can also be a script, batch file etc.), Send an email, or display a message on the screen. Make your selection and click Next.
Step 7
Assuming you selected to start a program, you now browse to that program or script, add any arguments it may require, and click next, then finish.
Now while still in computer management, looking at the left-hand menu, under ‘System Tools’ expand ‘Task Scheduler’. Then click on ‘Task Scheduler Library’ you will see your scheduled task in the list with the trigger events in the list. You can edit this at any time.
You can also set the task to run as a specific user under the ‘Security Options’ when viewing the task.
Add a sub network interface or additional IP address in Windows ServerRecovering accidentally deleted partitions Linux & Windows
- Remove From My Forums
-
Вопрос
-
Windows Server 2019 Standatr, домен.
Создаю задачу на запуск внешней программы. Повторение ежедневное. Повторять каждые 5 минут бесконечно. Задача с наивысшими правами вне зависимости от входа пользователя. Учетка доменная. UAC отключен совсем.
Если я указываю время начала выполнения задачи будущим временем — задача выполняется без ошибок однократно и повторов не происходит! Планировщик каждые 5 минут меняет дату следующего запуска программы на 5
минут в будущее но задачу не запускает. Время прошлого запуска не изменяется, в логах задачи пусто — т.е. вообще ничего не происходит!SCHTASKS /Query /v /fo list /TN SMSEmailSender
Папка:
Имя узла: SRVTS
Имя задачи: SMSEmailSender
Время следующего запуска: 21.10.2019 13:55:00
Состояние: Готово
Режим входа в систему: Интерактивный/фоновый
Время прошлого запуска: 21.10.2019 13:30:00
Прошлый результат: 0
Автор: TAv.sokolov
Задача для выполнения: «C:Program Files (x86)Microsoft OfficeOffice14MSACCESS.EXE» «D:Папка админовИсходникиSMSEmailSenderSMSEmailSender.accde»
/X runSend
Рабочая папка: Н/Д
Примечание: Н/Д
Состояние назначенной задачи: Включено
Время простоя: Отключено
Управление электропитанием: Останавливать при питании от батареи
Запуск от имени: v.sokolov
Удалить задачу, если она не перенесена: Отключено
Остановить задачу, если она выполняется X ч и X мин: Отключено
Расписание: Планирование данных в этом формате недоступно.
Тип расписания: Ежедневно
Время начала: 13:30:00
Дата начала: 21.10.2019
Дата окончания: N/A
дн.: Каждые 1 дн.
мес.: N/A
Повторять: каждые: 0 ч, 5 мин
Повторять: до: время: Нет
Повторять: в течение: длительность: Отключено
Повторять: остановить, если выполняется: ОтключеноЧто за колдунство?
Ответы
-
1. Попробуйте поменять «ежедневно» на «однократно» и оставить «повторять каждые 10 мин».
2. Попробуйте использовать другую УЗ для данной задачи (не вашу личную), а например сервисную с правами log as batch и неистекаемым паролем.
-
Помечено в качестве ответа
22 октября 2019 г. 8:41
-
Помечено в качестве ответа
sfc/scannow — проверил?
Dism/online/cleanup-image/restorehealth — Выполнил?
taskschd.msc «Вручную» с консоли «Под Админом» запускается?
Добавлено через 4 минуты
2019-12-18 07:17:35, Info CSI 000037f2 Warning: Overlap: Duplicate ownership for directory ??C:WindowsTasks in component Microsoft-Windows-TaskScheduler-Compatibility, version 10.0.17763.1, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}
2019-12-18 18:08:55, Info CSI 00003899 Warning: Overlap: Duplicate ownership for directory ??C:WindowsTasks in component Microsoft-Windows-TaskScheduler-Compatibility, version 10.0.17763.1, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}
2019-12-18 19:36:04, Info CSI 000048d2 Hashes for file member [l:18]’Task Scheduler.lnk’ do not match.
2019-12-18 19:36:04, Info CSI 000048d3 [SR] Cannot repair member file [l:18]’Task Scheduler.lnk’ of TaskSchedulerSettings, version 10.0.17763.1, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, hash mismatch
2019-12-18 19:36:07, Info CSI 00004937 [SR] Could not reproject corrupted file ??C:ProgramDataMicrosoftWindowsStart MenuProgramsAdministrative Tools\Task Scheduler.lnk; source file in store is also corrupted
2020-01-23 09:59:54, Info CBS Repr: Add missing payload:amd64_taskschedulersettings_31bf3856ad364e 35_10.0.17763.1_none_3bb0edaf5c865082Task Scheduler.lnk
У тебя тут целый «букет»…
- Remove From My Forums
-
Question
-
We’re using a physical installation of Windows Server 2019 Standard at a French location. The server is working normally. Task Scheduler is used for a small number of tasks. One of the tasks is supposed to repeat every half hour. The task indeed starts every
half hour but it runs four times in succession. I have attached screen prints of the task trigger screen and the task history. Why does Event ID 100 (Task started) appear four times at 08:58:01?
Answers
-
I created a task that runs a .CMD-file that launched DIR C:. Since CMD.EXE was never explicitly called, the /C parameter was not needed. The task was configured to run every 15 min and that’s exactly what it did. The task never repeated.
Interestingly, the original task was left running, also configured to run every 15 min. That’s exactly what it did as well. There were no repeats.
What changed? To solve a separate problem in Task Scheduler with a different task (see my post
here, I modified the following GPO:
Configuration ordinateur | Stratégies | Paramètres Windows | Paramètres de sécurité | Stratégies locales | Options de sécurité | Accès réseau : ne pas autoriser le stockage de mots de passe et d’informations d’identification pour l’authentification du réseau
Initially, I Defined and Enabled the setting, which proved disastrous. Then I Disabled the setting, but left it Defined.
Did that have an effect on this task? Maybe not, but I’m done testing Task Scheduler for now.
Thanks again for your suggestions.
regards, AndyA
-
Edited by
Thursday, June 18, 2020 3:29 PM
-
Proposed as answer by
sylvia_chenMicrosoft contingent staff
Friday, June 19, 2020 7:07 AM -
Marked as answer by
AAronoff
Friday, June 19, 2020 10:37 AM
-
Edited by
- Remove From My Forums
-
Question
-
We’re using a physical installation of Windows Server 2019 Standard at a French location. The server is working normally. Task Scheduler is used for a small number of tasks. One of the tasks is supposed to repeat every half hour. The task indeed starts every
half hour but it runs four times in succession. I have attached screen prints of the task trigger screen and the task history. Why does Event ID 100 (Task started) appear four times at 08:58:01?
Answers
-
I created a task that runs a .CMD-file that launched DIR C:. Since CMD.EXE was never explicitly called, the /C parameter was not needed. The task was configured to run every 15 min and that’s exactly what it did. The task never repeated.
Interestingly, the original task was left running, also configured to run every 15 min. That’s exactly what it did as well. There were no repeats.
What changed? To solve a separate problem in Task Scheduler with a different task (see my post
here, I modified the following GPO:
Configuration ordinateur | Stratégies | Paramètres Windows | Paramètres de sécurité | Stratégies locales | Options de sécurité | Accès réseau : ne pas autoriser le stockage de mots de passe et d’informations d’identification pour l’authentification du réseau
Initially, I Defined and Enabled the setting, which proved disastrous. Then I Disabled the setting, but left it Defined.
Did that have an effect on this task? Maybe not, but I’m done testing Task Scheduler for now.
Thanks again for your suggestions.
regards, AndyA
-
Edited by
Thursday, June 18, 2020 3:29 PM
-
Proposed as answer by
sylvia_chenMicrosoft contingent staff
Friday, June 19, 2020 7:07 AM -
Marked as answer by
AAronoff
Friday, June 19, 2020 10:37 AM
-
Edited by
@xby43
-
Windows
-
Системное администрирование
-
Windows Server
-
Планировщики задач
Необходимо на Windows Server 2019 выдать права обычному пользователю на запуск планировщика задач и возможность создавать задачи от имения своего пользователя
-
Вопрос заданболее года назад
-
196 просмотров
Комментировать
Подписаться
3
Средний
Комментировать
Решения вопроса 0
Пригласить эксперта
Ответы на вопрос 0
Ваш ответ на вопрос
Войдите, чтобы написать ответ
Войти через центр авторизации
Похожие вопросы
-
-
Windows
- +2 ещё
Простой
Как в WinSCP увидеть символические ссылки?
-
1 подписчик -
2 часа назад
-
17 просмотров
1
ответ
-
-
-
Системное администрирование
- +2 ещё
Средний
Что использовать для подключения к серверу из вне?
-
2 подписчика -
11 часов назад
-
111 просмотров
2
ответа
-
-
-
Windows Server
- +2 ещё
Простой
Как сопоставить логический диск в Windows c RAID-массивом?
-
1 подписчик -
15 часов назад
-
49 просмотров
2
ответа
-
-
-
Windows
- +2 ещё
Средний
My screen is darker when I switch Visual Studio Code to full screen, how do I fix this?
-
1 подписчик -
15 часов назад
-
77 просмотров
1
ответ
-
-
-
Windows
- +1 ещё
Средний
Как восстановить PPP-подключение в Windows 10?
-
1 подписчик -
18 часов назад
-
62 просмотра
2
ответа
-
-
-
Windows
- +1 ещё
Средний
Что делать если долго идет восстановление системы на 10 Виндовс?
-
1 подписчик -
вчера
-
62 просмотра
1
ответ
-
-
-
Windows
- +2 ещё
Простой
Какая есть альтернатива Google Drive for desktop?
-
1 подписчик -
вчера
-
86 просмотров
1
ответ
-
-
-
Windows
- +3 ещё
Сложный
Дисплей ноутбука не подключается к видео карте, как исправить?
-
1 подписчик -
вчера
-
58 просмотров
0
ответов
-
-
-
Windows
- +1 ещё
Средний
Как сравнить две папки и недостающие файлы перекинуть?
-
1 подписчик -
вчера
-
83 просмотра
5
ответов
-
-
-
Windows
- +4 ещё
Средний
T440p Lenovo, Возможно ли установить ОС Windows 10 или 11 22H2?
-
2 подписчика -
вчера
-
170 просмотров
4
ответа
-
-
Показать ещё
Загружается…
Вакансии с Хабр Карьеры
Администратор Windows
Абсолют Банк
•
Москва
от 150 000 ₽
Системный администратор (Windows, Linux)
Деловые решения
•
Москва
от 130 000 до 150 000 ₽
Системный администратор
intelsonline
•
Москва
от 80 000 ₽
Ещё вакансии
Заказы с Хабр Фриланса
Интеграция 1 С авто Альфа 6 и Битрикс 24
07 февр. 2023, в 23:29
3000 руб./за проект
Доработка маркета на laravel
07 февр. 2023, в 23:29
51000 руб./за проект
Сделать интро для видео YouTube
07 февр. 2023, в 23:02
2000 руб./за проект
Ещё заказы
Минуточку внимания
Присоединяйтесь к сообществу, чтобы узнавать новое и делиться знаниями
Зарегистрироваться