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, or showing a message box. Tasks can be scheduled to execute in response to these events, or triggers. On how to create a Scheduled task with Windows Admin Center, see https://techdirectarchive.com/2020/03/26/how-to-create-a-scheduled-task-with-windows-admin-center/
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
– 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)
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
More about schedule, see https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page
– Next. click on the Action tab
This will open a new Action tab as shown below
– 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.
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.
– 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