Get IT Solutions

How to do IT
Menu
  • Home
  • SCCM 2012
    • Deploy Packages
    • Troubleshooting errors SCCM 2012
  • Windows
    • Applications Silent Install
    • Windows Tools
    • Windows Error
    • Script
    • Exchange Server
    • Troubleshooting Office
    • Applications Errors
  • Database
    • SQL Server
    • MySQL
    • Oracle
  • Cybersecurity
  • Other
  • Reviews

How to create PowerShell scheduled task

To create PowerShell scheduled task it is convenient since you can leverage the PowerShell features in order to create, modify, and delete scheduled tasks with commands, and in this guide, we’ll show you how to complete these tasks.

The graphic interface of Taskschd.msc console is used to create Windows Task Scheduler jobs. The Task Scheduler is a useful tool that has been around for several years, and it provides a friendly graphical interface to create automated routines. By using this tool, you can automate tasks to launch applications, run specific commands, or execute scripts at a selected schedule or once a condition is met. As a sysadmin you can also use PowerShell to schedule, modify, and delete tasks, which can come in handy when you need to streamlined the process of creating tasks on several devices or when you need to create a PowerShell script that needs to interact with the console.

What is a PowerShell scheduled task?

Often, system admins, engineers, or developers might need to deploy a lot of difficult tasks with multiple schedules, triggers, or arguments. Here comes in help Scheduled tasks. They perform repeatable action in an automated way using ScheduledTasks module that’s built-in to Windows.  PowerShell can be used to form and manage scheduled tasks.

The advantage of creating a scheduled task with PowerShell is that you’ll be able to build one from the simplest to the most complex using different triggers and configurations. Once you are developing these automation scripts, you’ll be able to facilitate the whole process. PowerShell helps standardize the process and has the additional benefit of avoiding the same old errors that stem from manual entry.

PowerShell scheduled task

PowerShell scheduled task

PowerShell scheduled task requirements

Below are the requirements to create scheduled tasks using PowerShell:

  • In our examples, in this article, we will use Windows 10. But Windows Server 2012 and newer versions can do the same.
  • Windows PowerShell 5.1 or PowerShell 7.
  • Script editor such as Visual Studio Code, Notepad++, or Windows PowerShell ISE.

Before starting  you need to understand a brief explanation for each scheduled task component below:

  • Action – the action that is executed by the scheduled task. Action is typically to run a program or a script. A scheduled task can have more than one action.
  • Trigger – controls when the scheduled task runs. Triggers can be time-based, like, setting a schedule for daily or hourly recurrence. Triggers can also be activity-based, which runs a task based on detected activities like computer startup, a user logs in, or logged events.
  • Principal – controls the security context used to run the scheduled task. Among other things, a principal includes the user account and the required privilege used by the scheduled task.
  • Settings – is a set of options and conditions that controls how the scheduled task behavior. As an example, you can customize a task to get removed after a consecutive number of days that the task is unused.

Note: During a scheduled task creation, the principal and settings are not explicitly required. The default values get used instead.

How to create a scheduled task with PowerShell on Windows 10

To create PowerShell scheduled tasks on Windows 10, use these steps:

  1. Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.
  3. Type the following commands to create a variable to store the action of the task and press Enter. In the command, make sure to replace ‘PROGRAM’ with the name of the program you want to start. The “$action” is a variable, and it does not matter the name as long as you keep it short, simple, and descriptive. For example, this command tells Task Scheduler to start the Microsoft Word app:$action = New-ScheduledTaskAction -Execute ‘WINWORD.EXE’
    Create PowerShell scheduled tasks

    Create PowerShell scheduled tasks

  4. Type the following command to create a variable that stores the schedule information for the task and press Enter. In the command, make sure to replace SETTING and TIME with the details on when you want to run the task. The $trigger is a variable, and it does not matter the name. For example, this example tells Task Scheduler to run the task daily at 7 pm:
    $trigger = New-ScheduledTaskTrigger -Daily -At 7pm
    
  5. In the command, make sure to update “TASK-NAME” with the task’s actual name and “OPTIONAL-DESCRIPTION-TEXT” with the description of the task. The folder “-TaskPath” option is not a requirement, but it will help keep tasks separate. If you do not specify the option with a path, the task will be created inside the Task Scheduler Library folder. For example, this command creates as a scheduled task with the “testTask” name, custom description, and with settings specified on steps No. 3 and 4:
Register-ScheduledTask -Action $action -Trigger $trigger -TaskPath "MyTasks" -TaskName "testTask" -Description "This task opens the Word"

 

How to create a scheduled task with PowerShell

How to create a scheduled task with PowerShell

 

Once the steps are completed, the task is created and scheduled according to your configuration. You can check the created task on your Taskschd.msc console:

  1. Open Start.
  2. Search for TaskScheduler, right-click the top result, and select the Run as administrator option.
  3. Navigate using the left panel to MyTasks
PowerShell scheduled task

PowerShell scheduled task

How to delete scheduled task using PowerShell

To delete a scheduled task from the Task Scheduler with PowerShell, use these steps:

  1. 1.Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option. Type the following command to confirm the task exists and press Enter:
    Get-ScheduledTask -TaskName "TAKS-NAME"
  3. In the command, make sure to replace “TAKS-NAME” with the name of the task. For example, this command shows the testTask task that we already created on the previous step:
    Get-ScheduledTask -TaskName "testTask"
  4. Type the following command to delete the scheduled task and press Enter. In the command, make sure to replace “TAKS-NAME” with the name of the task. The “-Confirm:$false” option deletes the task without asking for confirmation. For example, this command deletes the testTask task that we already created on the previous step::
    Unregister-ScheduledTask -TaskName "testTask" -Confirm:$false
Delete scheduled task using PowerShell

Delete scheduled task using PowerShell

Create PowerShell scheduled tasks tips

  1. For “SETTING,” you can use -Once, -Daily, -Weekly, or -Monthly. And for the time, you can use the 12 or 24-hour format. If you are using the “Weekly” option, then you also provide the “-DaysInterval” or “-DaysOfWeek” information followed by the corresponding information. Type the following command to create the scheduled task using the variables you specified on the previous steps and press Enter:
    Register-ScheduledTask -Action $action -Trigger $trigger -TaskPath "TASK-FOLDER" -TaskName "TASK-NAME" -Description "OPTIONAL-DESCRIPTION-TEXT"
  2. 2.If you are trying to schedule a Command Prompt or PowerShell script, you will use the name of the program for the “-Execute” option and “-Argument” option to specify             the path of the script. For example:
    $action = New-ScheduledTaskAction -Execute 'cmd.exe' -Argument C:\scripts\myscript.bat

Conclusions

This guide focuses on the fundamental steps to start out managing scheduled tasks with PowerShell. The scheduled Tasks feature in Windows is a wonderful tool for fixing tasks or jobs. You’ll produce the foremost basic to additional complicated tasks. However, with PowerShell commands, you’ll manage several alternative settings such as delete and alter scheduled tasks. As you’ll see, it’s easy to make a scheduled task with PowerShell. however keep in mind that improper changes to your scheduled tasks will cause service interruptions and degrade computer performance. Therefore, it’s essential to trace all changes to your scheduled tasks.

Share
Tweet
Google+
Pinterest
Linkedin
Stumble
Email
Prev Article
Next Article

Related Articles

Superfetch Disable
The article will explain all the methods to disable Superfetch …

Solved: Disable Superfetch On Windows Including Cmd

All method to Disable Windows Defender on Winodws 10 including regedit
Windows Defender is designed to protect your PC against threats, …

All Method To Disable Windows Defender On Windows 10 Including Regedit

Best Computers & Laptops

Best Computer for Cyber Security – Laptop and Desktop
Best Computer for Cyber Security
Hey, are you seeking the best computer for cyber security? Well, we must say you have come to the right place to find your answer and guidance. There are a plethora of products out there for you to pick from ...
Read More
Best Computer for Microsoft Office & Excel – Laptop and Desktop
Best Computer for Microsoft Office & Excel
Are you finding the Best Computer for Microsoft Office and Excel? In modern days, the best laptop or desktop set is the one which is both portable, has good looks and offers the smoothest performance. Microsoft Office is a package ...
Read More
Best Computer for Hacking – Laptop and Desktop Selection
Best computer for Hacking
When it comes to hacking, either laptop or desktop, choosing the best computer for hacking would be an exhilarating job. There are many specifications to be considered for hacking ...
Read More

SQL Server Tips

FIX sqlstate 42000 – mysql error 1064 – you have an error in your sql syntax
Sqlstate 42000 Is a general code that come together with other number. Most often comes with the code 1064 and ...
Read More
The execute permission was denied on the object – SQL Server Error
The execute permission was denied on the object
The following article will handle “the execute permission was denied on the object” error appears on SQL Server. This error ...
Read More
How to Read Data from LDF file in SQL Server – A Complete Guide
Read LDF File
Hello Everyone, Today we are going to address the most popular query of SQL users, how to read data from ...
Read More

Search

We are on:

Get FREE SPACE for your PC

3 Method to Delete Temp Files in Windows 7/10 including vbs script

In this post we will explain how to delete temp files windows 7 using three different methods including vbs script ...
Read More

Fastest way to delete hiberfil sys from windows 10/8/7 and XP – CMD

In this article we will explain how to remove or delete hiberfil sys from Windows 10/8/7 and XP . If you does ...
Read More

Learn How to Silent Install Applications

Silent Install Adobe Flash Player
In this tutorial will explain how to silent install adobe flash player 25, Msi and Exe version. How to disable auto update and uninstall older ...
Read More
Java Silent Install and Uninstall Older Version – Deploy Package MSI
This tutorial will explain how to silent install Java MSI/EXE version and disable auto-update. The command line will also uninstall the ...
Read More
Silent Install Adobe Shockwave Player 12 and disable update
In this tutorial will explain how to silent install Adobe Shockwave Player 12 msi and disable auto update. The command will uninstall older ...
Read More
Silent Install Google Chrome MSI, Silent Uninstall and Disable Auto Update
This tutorial will explain how to silent install Google Chrome MSI and disable auto update. The command will uninstall older version of ...
Read More
Silent Install Adobe Reader 11 and DC – msi and exe – disable update
In this tutorial will explain how to silent install Adobe Reader version 11 and DC. We will user both version "msi" ...
Read More
Silent Install Mozilla Firefox msi and exe file – Including Silent Uninstallation
This tutorial will explain how to silent install Mozilla Firefox. We will use MSI and EXE files to perform a silent ...
Read More
Skype Silent Install Msi and disable updates
In this tutorial will explain how to silent install skype  and disable auto update. The command will uninstall older version of Skype and ...
Read More
Filezilla Silent Install msi and exe version
Filezilla silent install tutorial will explain how to perform a silent installation of application. We will explain methods, silent install ...
Read More
Silent install VLC Media Player
In this tutorial will explain how to silent install VLC Media Player. We will explain both methods for exe and ...
Read More
Notepad++ silent install exe and msi version – Command Line
Notepad++ silent install is the new article from a series of silent installations. Notepad++ as free software has two main ...
Read More

Batch File Solutions

How to list files in cmd – Command Prompt – Windows 10
Whenever you want to search and make a list of all files on a specific folder, you used the windows ...
Read More
Batch rename multiple files in folder – CMD script – Bulk Method – Win 10
The following article will teach how to rename multiple files in a folder with the bulk method using Command Line ...
Read More
Batch script rename file using Command Line (CMD) & PowerShell – Windows 10
The following article will use the “rename” or “ren” command to rename the file using a command prompt. Also, we ...
Read More
Change extension of multiple files at once – CMD batch file
The following article will teach the methods to change the extension of multiple files at once using command prompt and ...
Read More
How to delete registry key with command line | PowerShell | Batch
The following article is the third of series about registry and working on it through command line (CMD) and PowerShell ...
Read More
How to add registry key & values with CMD | PowerShell | Batch
The registry is the place where most of the applications store the settings but not only. Used also from the ...
Read More
Unmap Network Drive CMD – (Batch file) – net use delete command
After we posted the methods to map network drive using cmd commands we come this time with the method to ...
Read More
Map Network Drive cmd (batch file) – net use user password
This article will focus on another way to map a network drive on your computer instead of from the explorer ...
Read More
How to Find Large Files on Windows 7 & 10 – CMD Forfiles Command
If the capacity of your hard drive is running low, it is time to clean off some files and to ...
Read More
CMD Script to check disk space on windows and multiple remote servers
The following article will provide you script to check disk space. The Script monitor space on windows and multiple remote ...
Read More

Get IT Solutions

How to do IT

About Us

Get IT Solutions is a personal blog, which is managed to guide people for various topic.

Second Menu

  • Donate
  • About Us
  • Contact Us
  • Privacy Policy

What Will You Find

Automation is our area of writing where are included scripts, batch and various tips to automate your daily job.
Copyright © 2025 Get IT Solutions