General Export List of Scheduled Tasks in Windows 11

  • Thread starter Thread starter Brink
  • Start date Published: Start date Updated Updated:

Task_Scheduler_banner.webp

This tutorial will show you how to export a list of all, only disabled, only enabled, or only running scheduled tasks in Windows 10 and Windows 11.

The Task Scheduler service allows you to perform automated tasks on a chosen computer. With this service, you can schedule any program to run at a convenient time for you or when a specific event occurs. The Task Scheduler monitors the time or event criteria that you choose and then executes the task when those criteria are met.

A task is the scheduled work that the Task Scheduler service performs. A task is composed of different components, but a task must contain a trigger that the Task Scheduler uses to start the task and an action that describes what work the Task Scheduler will perform.

You can export the list of scheduled tasks to either a TXT file or grid view. The list of scheduled tasks will show you the TaskPath in Task Scheduler, TaskName, and current State of each task.

This does not export your tasks. It will only export a list of your tasks for reference.



Contents





Option One

Export List of All Scheduled Tasks


1 Open Windows Terminal, and select Windows PowerShell.

2 Copy and paste the command below you want to use into Windows PowerShell, and press Enter. (see screenshots below)

(Output to GridView)
Get-ScheduledTask | Out-GridView

OR

(Output to .txt file on Desktop)
Get-ScheduledTask | Format-Table -AutoSize | Out-File "$Env:userprofile\Desktop\All_Scheduled_Tasks.txt"

List_all_scheduled_tasks_gridview_PowerShell.png

List_all_scheduled_tasks_to_file_PowerShell.png

List_all_scheduled_tasks_gridview.png





Option Two

Export List of Only Disabled Scheduled Tasks


1 Open Windows Terminal, and select Windows PowerShell.

2 Copy and paste the command below you want to use into Windows PowerShell, and press Enter. (see screenshots below)

(Output to GridView)
Get-ScheduledTask | where state -eq 'Disabled' | Out-GridView

OR

(Output to .txt file on Desktop)
Code:
Get-ScheduledTask | where state -eq 'Disabled' | Format-Table -AutoSize | Out-File "$Env:userprofile\Desktop\Disabled_Scheduled_Tasks.txt"

List_all_disabled_scheduled_tasks_gridview_PowerShell.png

List_all_disabled_scheduled_tasks_to_file_PowerShell.png

List_all_disabled_scheduled_tasks_gridview.png





Option Three

Export List of Only Enabled Scheduled Tasks


1 Open Windows Terminal, and select Windows PowerShell.

2 Copy and paste the command below you want to use into Windows PowerShell, and press Enter. (see screenshots below)

(Output to GridView)
Get-ScheduledTask | where state -eq 'Ready' | Out-GridView

OR

(Output to .txt file on Desktop)
Code:
Get-ScheduledTask | where state -eq 'Ready' | Format-Table -AutoSize | Out-File "$Env:userprofile\Desktop\Enabled_Scheduled_Tasks.txt"

List_all_enabled_scheduled_tasks_gridview_PowerShell.png

List_all_enabled_scheduled_tasks_to_file_PowerShell.png

List_all_enabled_scheduled_tasks_gridview.png





Option Four

Export List of Only Running Scheduled Tasks


1 Open Windows Terminal, and select Windows PowerShell.

2 Copy and paste the command below you want to use into Windows PowerShell, and press Enter. (see screenshots below)

(Output to GridView)
Get-ScheduledTask | where state -eq 'Running' | Out-GridView

OR

(Output to .txt file on Desktop)
Code:
Get-ScheduledTask | where state -eq 'Running' | Format-Table -AutoSize | Out-File "$Env:userprofile\Desktop\Running_Scheduled_Tasks.txt"

List_all_running_scheduled_tasks_gridview_PowerShell.png

List_all_running_scheduled_tasks_to_file_PowerShell.png

List_all_running_scheduled_tasks_gridview.png



That's it,
Shawn Brink


 
Last edited:
Shawn, I want to change the operational location of scheduled tasks, because System Restores revert tasks collection to
a past state. Important schedules lost. I hoped to assign, via registry, a location in a different partition, did not find a relevant setting.
 

My Computer

System One

  • OS
    Win11 Pro 23H2
Shawn, I want to change the operational location of scheduled tasks, because System Restores revert tasks collection to
a past state. Important schedules lost. I hoped to assign, via registry, a location in a different partition, did not find a relevant setting.

Hello, :alien:

I don't believe you can change tasks to be on a different drive since they are just references in Task Scheduler to perform an action instead.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    CyberPower CP1500PFCLCD
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender
Hello, :alien:

they are just references

I do not understand.
Each scheduled task exists as a file containing all of the information that we see when we view the scheduled task in the program's UI.

I guess that I will have to create a scheduled task to export often all of the scheduled task files. After System Restore I would import the exported scheduled task files whose dates are later than the latest of the restored scheduled task files.
 

My Computer

System One

  • OS
    Win11 Pro 23H2
technically, i believe you could just create a mirror of the tasks folder on your other drive and symlink them so that it looks to C:\... but is actually referencing D:\...

but since that is something windows will load at boot, you would always have to have the other drive connected or it will throw errors at boot
 

My Computer

System One

  • OS
    Windows 11 Pro
Scheduled tasks are stored both in the Registry, and as on-disk task files. When you do a System Restore, Scheduled tasks are considered part of the critical Windows system data that needs to be rolled back.

So you can't really keep two different versions of the data, inside the Registry. Your restore checkpoints will represent different snapshots in time.

Be aware that exporting a list of stored tasks isn't the same as backing up a task for restoration. For that, each task needs to be exported one at time as XML files.
 

My Computer

System One

  • OS
    Windows 7
Scheduled tasks are stored both in the Registry, and as on-disk task files. When you do a System Restore, Scheduled tasks are considered part of the critical Windows system data that needs to be rolled back.
Good to know, thanks.

each task needs to be exported one at time
True if using the UI to do it. I propose to create a task to copy the files.
 

My Computer

System One

  • OS
    Win11 Pro 23H2
Well, you need something like PowerShell to loop through the different Task Folders, and export them. Doable.
 

My Computer

System One

  • OS
    Windows 7
The PowerShell script below can be used to backup scheduled tasks. You must edit the variables in the script to make it include/exclude taskpaths that you can specify. For example, to include all tasks (the root and all of its subfolders with recursion) but exclude the ones in the Microsoft folder and all of its subfolders with recursion:
$IncludeFolders = @()
$IncludeFoldersRecursion = @('\')
$ExcludeFolders = @()
$ExcludeFoldersRecursion = @('\Microsoft\')

Additionally, you must edit the variables to specify what UserIDs you want to be removed from the Author element of the tasks. The reason why you might want certain UserIds to be removed is because a task cannot be imported on systems that do not contain a matching user account.

Powershell:
$dest = "Z:\My Tasks Backup"  # Where to put the files. Do not include trailing backslash.
$IncludeFolders = @('\', '\Folderpath1\', '\Folderpath2\')  # Task folders to include. Must have backslashes. "\" is the root folder.
$IncludeFoldersRecursion = @('\')  # Task folders to include with subfolder recursion.
$ExcludeFolders = @('\Folderpath3\', '\Folderpath4\')  # Task folders to exclude.
$ExcludeFoldersRecursion = @()  # Task folders to exclude with subfolder recursion.

# UserId inclusions and exclusions
$IncludeUserIds = @('User1', 'User2')  # Example UserIds to include in the removal
$ExcludeUserIds = @('User3', 'User4')  # Example UserIds to exclude from the removal

# Booleans to control UserId removal
$RemoveUserIds = $true  # If you want to disable removal of UserIds, change this to $false.
$IncludeAllExceptExcluded = $true  # If you don't want to include all UserIds (except the excluded ones), change this to $false.

# Initialize log file if logging is enabled
$log = "Z:\Log file.txt"  # If you want to disable logging, put a hashtag in front of this line.
$l = ($null -ne $log)
if ($l) { try { Out-File $log -Encoding UTF8 } catch { Exit } }

# Verify source directory exists
$src = "$($env:windir)\System32\Tasks"
if (!(Test-Path -PathType Container $src)) {
    if ($l) { "ERROR: The source folder `"$($src)`" does not exist." | Out-File $log -Encoding UTF8 }
    Exit
}

# Create destination directory if it doesn't exist
if (!(Test-Path -PathType Container $dest)) {
    $null = (mkdir -Force $dest)
    if (!(Test-Path -PathType Container $dest)) {
        if ($l) { "ERROR: Can't create the destination folderpath `"$($dest)`"." | Out-File $log -Encoding UTF8 }
        Exit
    }
}

if ($l) { "$($src)`n" | Out-File $log -Encoding UTF8 -Append }

# Process each task XML file
$taskFiles = Get-ChildItem -Path $src -Recurse -File
foreach ($file in $taskFiles) {
    $taskPath = $file.DirectoryName.Substring($src.Length)
    $taskName = $file.BaseName

    $skip = $true

    # Check if task is in included folders
    if ($taskPath -in $IncludeFolders) { $skip = $false }
    foreach ($path in $IncludeFoldersRecursion) {
        if ($taskPath.StartsWith($path)) {
            $skip = $false
            break
        }
    }

    # Check if task is in excluded folders
    if ($taskPath -in $ExcludeFolders) { $skip = $true }
    foreach ($path in $ExcludeFoldersRecursion) {
        if ($taskPath.StartsWith($path)) {
            $skip = $true
            break
        }
    }

    if ($skip) {
        if ($l) { "Ignoring {0}\{1}" -f $taskPath, $taskName | Out-File $log -Encoding UTF8 -Append }
    } else {
        if ($l) { "Processing task {0}\{1}" -f $taskPath, $taskName | Out-File $log -Encoding UTF8 -Append }

        $folder = "$dest$($taskPath)"
        if (!(Test-path $folder)) {
            New-Item -Path $folder -ItemType Directory  # Create the directory
        }

        # Read task XML content
        $taskXml = [xml](Get-Content -Path $file.FullName -Encoding Unicode)

        # Remove UserId element if it exists and conditions are met
        if ($RemoveUserIds) {
            $taskXml | Select-Xml -XPath '(/*[local-name()=''Task'']/*[local-name()=''Principals'']/*[local-name()=''Principal''])[1]' | ForEach-Object {
                $UserId = $_.Node.UserId
                $remove = $false

                if ($IncludeAllExceptExcluded) {
                    if ($UserId -notin $ExcludeUserIds) {
                        $remove = $true
                    }
                } else {
                    if ($UserId -in $IncludeUserIds) {
                        $remove = $true
                    }
                }

                if ($remove) {
                    if ($l) {
                        "`"$($taskXml.Task.RegistrationInfo.URI)`" , " | Out-File $log -Encoding UTF8 -Append -NoNewLine
                    }
                    try {
                        $null = $_.Node.RemoveChild($_.Node.Item('UserId'))
                        if ($l) { "`"$UserId`"" | Out-File $log -Encoding UTF8 -Append }
                    } catch {
                        if ($l) { "NULL" | Out-File $log -Encoding UTF8 -Append }
                    }
                }
            }
        }

        # Save the modified XML to the destination
        $settings = New-Object System.Xml.XmlWriterSettings
        $settings.Indent = $true
        $settings.Encoding = [System.Text.Encoding]::Unicode
        $XmlWriter = [System.XML.XmlWriter]::Create("$dest$($taskPath)\$($taskName).xml", $settings)
        $taskXml.Save($XmlWriter)
        $XmlWriter.Close()
        if ($l) { "$dest$($taskPath)\$($taskName).xml" | Out-File $log -Encoding UTF8 -Append }
    }
}
The script below can be used to restore tasks from the backup. You must edit the variables in the script, and also be aware that choosing whether or not to let already existing tasks be overwritten might have serious repercussions, especially if they are running.

Also keep in mind that there might be dependencies between some of the tasks and/or between other factors and them so, please avoid to use this script to restore those specific tasks that you do not fully understand.
Powershell:
$backupDir = "Z:\My Tasks Backup"  # Backup folder
$noclobber = $true  # If you want to disable protection of already existing tasks, change this to $false.
$protectRunningTasks = $true  # If you want to disable protection of running tasks, change this to $false.

# Initialize log file if logging is enabled
$log = "Z:\Log file.txt"  # If you want to disable logging, put a hashtag in front of this line.
$l = ($null -ne $log)
if ($l) { try { Out-File $log -Encoding UTF8 } catch { Exit } }

# Verify backup directory exists
if (!(Test-Path -PathType Container $backupDir)) {
    if ($l) { "ERROR: The backup folder `"$($backupDir)`" does not exist." | Out-File $log -Encoding UTF8 }
    Exit
}

# Process each task XML file
$taskFiles = Get-ChildItem -Path $backupDir -Recurse -File -Filter "*.xml"
foreach ($file in $taskFiles) {
    $taskPath = $file.DirectoryName.Substring($backupDir.Length) + "\"

    # Read task XML content to get the URI
    $taskXml = [xml](Get-Content -Path $file.FullName -Encoding Unicode)
    $taskName = $taskXml.Task.RegistrationInfo.URI
    $taskName = $taskName.Substring($taskName.LastIndexOf("\") + 1)

    # Check if task already exists
    try {
        $existingTask = Get-ScheduledTask -TaskName $taskName -TaskPath $taskPath
    } catch {
        $existingTask = $null
    }

    # Check if the existing task is running
    $isRunning = $false
    if ($existingTask) {
        $isRunning = ($existingTask.State -eq 'Running')
    }

    if ($noclobber -and $existingTask) {
        if ($l) { "Skipping existing task $taskPath$taskName" | Out-File $log -Encoding UTF8 -Append }
    } elseif ($protectRunningTasks -and $isRunning) {
        if ($l) { "Skipping running task $taskPath$taskName" | Out-File $log -Encoding UTF8 -Append }
    } else {
        if ($existingTask) {
            Start-Process schtasks -ArgumentList "/Delete /TN `"$taskPath$taskName`" /F" -NoNewWindow -Wait
        }
        Start-Process schtasks -ArgumentList "/Create /TN `"$taskPath$taskName`" /XML `"$($file.FullName)`"" -NoNewWindow -Wait
        if ($l) { "Restored task $taskPath$taskName" | Out-File $log -Encoding UTF8 -Append }
    }
}
 
Last edited:

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
Thanks, Garlin.

Yesterday I created my scheduled task, runs a one-liner batch command.
 

My Computer

System One

  • OS
    Win11 Pro 23H2
Back
Top Bottom