Most we will use the graphic interface of Taskschd.msc console to create Windows Task Scheduler jobs and Building a single scheduled task via the GUI task scheduler might not be a big deal.ย But if you find yourself creating scheduled tasks repeatedly it might be a good idea to use a method that scales better than a GUI like PowerShell.ย  However, in various scripts and automated jobs, it is much more convenient to use the PowerShell features to create scheduled tasks. In this article, we will discuss about how to create new Windows Scheduler tasks using PowerShell.

PowerShell v4 introduced a ScheduledTasks module that greatly simplified the times of creating Task Scheduler COM objects to build scheduled tasks from the command line. To create Task Scheduler, we can utlize the below setting.

Example: Passing PS file as argument

Example: Passing scrip as argument

OUTPUT

Explanation

New-ScheduledTaskAction

The New-ScheduledTaskAction cmdlet creates an object that contains the definition of a scheduled task action.ย A scheduled task action represents a command that a task executes when Task Scheduler runs the task.

New-ScheduledTaskTrigger

The New-ScheduledTaskTrigger cmdlet creates and returns a new scheduled task trigger object.

New-ScheduledTaskPrincipal

Creates an object that contains a scheduled task principal. Using this we can registers a scheduled task that will run as the Local Service account orย scheduled task that runs under logged-in members of the Administrators user group that has the highest privileges.

New-ScheduledTaskSettingsSet

The New-ScheduledTaskSettingsSet cmdlet creates an object that contains scheduled task settings. Each scheduled task has one set of task settings.

New-ScheduledTask

The New-ScheduledTask cmdlet creates an object that contains the definition of a scheduled task. New-ScheduledTask does not automatically register the object with the Task Scheduler service.

Register-ScheduledTask

The Register-ScheduledTask cmdlet registers a scheduled task definition on a local computer.

 

What do you think?

I hope you have idea of how to create Task in Window task scheduler using Powershell . I would like to have feedback from my posts readers. Your valuable feedback, question, or comments about this article are always welcome.