Scheduled tasks represent the central mechanism for executing programs at certain times or events. Since PowerShell 3.0 you can manage scheduled tasks with several cmdlets.
Profile gravatar of Wolfgang Sommergut

Wolfgang Sommergut

Wolfgang Sommergut has over 20 years of experience in IT journalism. He has also worked as a system administrator and as a tech consultant. Today he runs the German publication
Profile gravatar of Wolfgang Sommergut

A freshly installed Windows already comes with a variety of pre-defined tasks for system maintenance. Important services such as the virus scanner, the backup program, and Windows Update depend on them.

Analyzing existing tasks ^

Over the course of time, third-party applications add more and more tasks usually used for automatically downloading updates. However, it is not always optimal if every unimportant tool continuously runs its own update service.

PowerShell is often more efficient than GUI programs if you want to analyze and change the settings and data of system components. Even though the Windows Task Scheduler supports all available task features, navigating through the numerous tabs is sometimes time-consuming.

Displaying scheduled tasks with Get-ScheduledTask ^

If you want to get an overview of the task states and authors, Get-ScheduledTask offers help. If you run the cmdlet without parameters, it displays all available tasks with their properties TaskPath, TaskName, and State.

TaskPath provides information about the tasks' position in the Task Scheduler's tree structure. You need the task location to access its details. Possible State values are Ready, Running, and Disabled.

Displaying task location and status with Get ScheduledTask

Displaying task location and status with Get ScheduledTask

For instance, to display all disabled Tasks, you have to execute this command:

Get-ScheduledTask allows you to restrict the query with the help of TaskName and TaskPath whereby both parameters support wildcards.

Reading task details ^

If you need detailed information for a particular task, the Get-ScheduledTaskInfo cmdlet is useful. It will give you details such as the time since the last start, the number of missed runs, and the result of the last run.

Because Get-ScheduledTaskInfo requires you to specify TaskPath, it is easier if you call Get-ScheduledTask with the task's name and then pass the result to Get-ScheduledTaskInfo:

Get ScheduledTaskInfo provides details for scheduled tasks

Get ScheduledTaskInfo provides details for scheduled tasks

You can also use the information that Get-ScheduledTaskInfo provides to filter certain tasks:

This command displays all tasks with missed runs.

Disabling tasks ^

If you want to disable a particular task, for instance because it always fails, you can run the Disable-ScheduledTask cmdlet. Like Get-ScheduledTask, it accepts the parameters TaskPath and TaskName to restrict its application to certain tasks. But unlike Get-ScheduledTask, Disable-ScheduledTask doesn't support wildcards.

However, in most cases you will want to filter the list with certain criteria and then pass it to Disable-ScheduledTask:

Activating, stopping, starting, and deleting tasks ^

Activating, stopping, and continuing scheduled tasks works along similar lines. PowerShell provides the cmdlets Enable-ScheduledTask, Stop-ScheduledTask, and Start-ScheduledTask for this purpose. For example, to stop all currently running tasks, you can run this command:

If you don't just want to stop or disable a task, but want to remove it completely, you can work with Unregister-ScheduledTask.

Take part in our competition and win $100!


Users who have LIKED this post:

  • avatar

Related Posts

  1. Profile gravatar of Ray
    Ray 1 month ago

    Your command for getting the state doesn't work, The name "state" is not a proper name, After exporting to a csv I was able to see that it should be scheduledtaskstate. The following line gave me clear output for just the name and whether it was enabled or not.

    Get-ScheduledTask | ? scheduledtaskstate -eq Enabled | Select-Object Taskname, scheduledtaskstate

    • Profile gravatar of Michael Pietroforte
      Michael Pietroforte 4 weeks ago

      If you look at the first screenshot, you will see that state is a valid property. Maybe you didn't get any results because you have no scheduled task configured? Try "disabled" instead of "enabled."

      • Profile gravatar of Ray
        Ray 3 weeks ago

        Whether or not it shows that the switch is valid, it is not working correctly. I have scheduled tasks enabled. Tested it on a system that has 4 scheduled tasks that I set myself when the server was built. I also have all the default MS Windows tasks in one or the other state. All of my manually created tasks are enabled and run at defined times every day. They show successful and are confirmed successful by me verifying that the tasks copied and deleted the log files.

        I'm running PS 4 or 5 on all my servers currently, and the one I tested on is using PS4 as shown below. It is above PS3 which is the version that includes this

        Major Minor Build Revision
        ----- ----- ----- --------
        4           0           -1        -1

        Doesn't work when state is -eq Enabled, but pulls all MS Windows tasks when Disabled is selected. It does not pull any tasks from manually created scheduled tasks. It also does not pull any tasks MS Windows tasks that are enabled. The only way I have found to show all tasks correctly is the method I have provided in my first comment.



        • Profile gravatar of Luc Fullenwarth
          Luc Fullenwarth 3 weeks ago


          What is the OS version of the system where you scheduled your tasks?

          What is the output when you type Get-ScheduledTask |Get-Member

      • Profile gravatar of Ray
        Ray 3 weeks ago

        I have found the first problem in that "State" is "Ready" instead of "Enabled" which is MS being non-standard in naming. Scheduledtaskstate is "Enabled" or "Disabled".



        Users who have LIKED this comment:

        • avatar

Leave a reply

Your email address will not be published. Required fields are marked *



Please ask IT administration questions in the forum. Any other messages are welcome.

© 4sysops 2006 - 2017

Log in with your credentials


Forgot your details?

Create Account