In this guide, you will learn how to list all Scheduled Tasks using PowerShell.
I will walk you through several examples for local and remote computers, and also show you how to filter the task list.
Table of Contents:
- Get-ScheduledTask Command Syntax
- List Scheduled Tasks on Local Computer
- Filter Commands
- List Scheduled Tasks on Remote Computer
- Get Scheduled Tasks on All Computers (Graphical Tool)
The Get-ScheduledTask Command (Syntax)
The Get-ScheduledTasks command is used to get the registered tasks on a local computer. By using the command parameters you can also get a list from remote computers.
To view the command syntax use the below command.
get-command -Module get-scheduledtasks
List Scheduled Tasks on Local Computer
To list the scheduled tasks on your local command run the command below.
Filter Scheduled Tasks List
Here are some commands to filter the list of scheduled tasks.
List all Active Scheduled Tasks
Use this command to display only the active scheduled tasks.
get-scheduledtask | where state -eq 'Ready'
List all Disabled Scheduled Tasks
To display all the disabled scheduled tasks use this command.
get-scheduledtask | where state -eq 'Disabled'
List Scheduled Tasks Using Wildcard Search
If you don’t know the name of a scheduled task you can use a wildcard search. In this example, I’ll list any scheduled tasks that have “Firefox” in the taskname.
get-scheduledtask -taskname 'windows*'
Here is one more wildcard example. In this example, I want to list all of the Microsoft Office scheduled tasks. I’ll search for any taskname that has Office in the name.
get-scheduledtask -taskname 'Office*'
List Scheduled Tasks on Remote Computer
To get a list of scheduled tasks on a remote computer, you can use the -CimSession parameter. You will need PowerShell Remoting enabled for this to work.
In this example, I’m working on DC1 and will get the scheduled tasks on remote computer PC1.
Get-ScheduledTask -CimSession PC1
Get Scheduled Tasks on All Computers (Graphical Tool)
In this example, I’ll use the Service Accounts Report Tool to list all scheduled tasks on a group of computers. This is an easy-to-use graphical tool that can also list windows services.
One issue with the PowerShell Get-ScheduledTask command is that it does not provide a lot of details such as the account it is running as (username).
This GUI tool solves that problem by displaying additional details like Running As, Last Run Results, and Last Run time.
This is useful to help track down Active Directory accounts that are running scheduled tasks or windows services on remote computers. These accounts can become a security risk and cause random account lockouts.
Step 1: Select Computers
Select to scan all computers, an OU/group, or search the domain for specific computers.
Step 2: Click Run
Click the “Run” button and the tool will scan the selected computers for Scheduled tasks and windows services.
When the report is completed you can click on any column to easily filter and sort the results. In this example, I’ve filtered for any task and service running as “robert.allen”.
I found that my Active Directory account is being used to run a Scheduled Task on server “SRV-VM1”.
You can filter and sort on any column. In the screenshot below I’ve filtered for all tasks and services that are running.
In this guide, I showed you how to use PowerShell to list the scheduled tasks on local and remote computers. Although the Get-ScheduledTasks is easy to use, it may not provide all the details you need when scanning remote computers.
I created the Service Accounts Report Tool to make it easy for System Administrators to inventory scheduled tasks and Windows Services on multiple computers. It’s a huge time saver and can help you track down Active Directory accounts running as a service.