Use PowerShell to manage Scheduled Tasks in Windows

Martin Brinkmann
Sep 23, 2015
Updated • Sep 24, 2015
Windows
|
6

I check several locations regularly on Windows systems that I run including the Windows Task Manager to list running processes, the autostart entries, and also the scheduled tasks of the system.

I do that for a couple of reasons including security to make sure nothing slipped by and is running on the system that I consider malicious, spyware or unwanted in other ways, but also to debloat the system by disabling, blocking or removing programs from starting with the system or on schedule.

While it is possible to open the Task Scheduler using search, it does not provide you with a clean interface to go through the list of tasks quickly.

A program that I like to use for the task is Nirsoft's excellent Task Scheduler View which, as usual, is portable and highly efficient.

The PowerShell of Windows offers another quick option on Windows 8 and later. The command Get-ScheduledTask returns all or select scheduled tasks of the local computer.

  1. Open a command prompt window. You can do that with a tap on the Windows-key, typing Powershell.exe, right-clicking on the result, selecting "run as administrator" and hitting enter. Note that the get-scheduledtask command does not require elevation while all management commands do.
  2. Type Get-ScheduledTask

The basic command lists all tasks of the local computer sorted by path. It only includes the task path, task name and state of the task which may be sufficient at times.

The name helps with the identification of the task while the state highlights whether it is enabled or disabled.

What makes this more powerful however are the parameters that you may add to the command to display additional details or filter tasks.

Here are some command examples that you may find useful:

  • Get-ScheduledTask -TaskName Google* returns all tasks that start with Google.
  • Get-ScheduledTask -TaskPath \ returns all tasks that are placed in the TaskPath root.

While it is useful to display scheduled tasks this way, you may also manage tasks using the PowerShell. Please note that you need elevated rights to run disable or enable tasks on a system. This means that you need to run PowerShell from an elevated command prompt.

The commands Disable-ScheduledTask and Enable-Scheduled-Task have been designed for that. As the names suggest, the first disables tasks you select while the second enables them.

If you run the commands directly, you need to specify task names or paths explicitly. There is a workaround for that though that you can use to enable or disable multiple tasks at once.

Commands that you may find useful are:

  • Disable-ScheduledTask -taskname "Adobe Flash Player Updater" disables the task Adobe Flash Player Updater.
  • Enable-ScheduledTask -taskname "Adobe Flash Player Updater" enables the task Adobe Flash Player Updater.
  • Get-ScheduledTask -taskname Google* | Disable-ScheduledTask disables all tasks the get command returns (starting with Google),

Other task related commands of interest are start-scheduledtask, stop-scheduledtask and unregister-scheduledtask.

Summary
Article Name
Use PowerShell to manage Scheduled Tasks in Windows
Description
Find out how to use the PowerShell in Windows to list, disable and enable scheduled tasks.
Author
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. PhoneyVirus said on September 29, 2015 at 4:45 pm
    Reply

    Wish this would’ve work on Windows 7 becasue it don’t and really wanted to get to know PowerShell sad next time I guess when I decided to move on to Windows 10.

  2. Velocity.Wave said on September 27, 2015 at 1:10 am
    Reply

    Thanks Martin!

    The more it goes, and the more articles I see like yours… the more I realize that I had better pick up a couple of good Powershell books, sooner, rather than later, since I still work Windows, and many of those I support, likewise work entirely within a Windows ecosystem.

    Whatever happened to the more innocent days of batch file scripts!?

  3. Maou said on September 24, 2015 at 4:36 am
    Reply

    “You can do that with a tap on the Windows-key, typing cmd.exe” typo maybe? That’s not the Powershell shortcut.

    Anyway, thanks Martin.

    1. Martin Brinkmann said on September 24, 2015 at 6:18 am
      Reply

      Yeah, it is easier to open PowerShell directly of course ;)

  4. Harding said on September 23, 2015 at 9:45 pm
    Reply

    I would suggest checking out sysinternals autorun. It will show you “all” programs that autostart and you can see if they are signed and there is an excellent option to check hashes against virustotal.com

    1. Martin Brinkmann said on September 23, 2015 at 9:58 pm
      Reply

      I agree, it is an invaluable tool which Microsoft should have integrated into Windows a long time ago. I do think however that is is good to have several aces up your sleeve at all time, and PowerShell is a mighty powerful weapon that is hardly ever talked about it seems in mainstream media.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.