Get-RemoteScheduledTasks.ps1
19 Sep 2025Description
Purpose
Export a list of scheduled tasks from a remote computer and their properties.
Detailed Description
The Get-RemoteScheduledTasks function retrieves a list of scheduled tasks from a remote computer and returns their properties. It uses the Get-ScheduledTask cmdlet to get the list of tasks and the Get-ScheduledTaskInfo cmdlet to retrieve additional information about each task.
Usage
Example 1
Get-RemoteScheduledTasks -ComputerName "RemoteComputer01"
This example retrieves the scheduled tasks from the remote computer named “RemoteComputer01” and displays their properties.
Notes
Author: Your Name Date: Today’s Date Version: 1.0
Script
<#
.SYNOPSIS
Export a list of scheduled tasks from a remote computer and their properties.
.DESCRIPTION
The Get-RemoteScheduledTasks function retrieves a list of scheduled tasks from a remote computer and returns their properties. It uses the Get-ScheduledTask cmdlet to get the list of tasks and the Get-ScheduledTaskInfo cmdlet to retrieve additional information about each task.
.PARAMETER ComputerName
The name of the remote computer from which to retrieve the scheduled tasks.
.EXAMPLE
Get-RemoteScheduledTasks -ComputerName "RemoteComputer01"
This example retrieves the scheduled tasks from the remote computer named "RemoteComputer01" and displays their properties.
.INPUTS
System.String
.OUTPUTS
System.Management.Automation.PSCustomObject
.NOTES
Author: Your Name
Date: Today's Date
Version: 1.0
#>
function Get-RemoteScheduledTasks {
[CmdletBinding( DefaultParameterSetName = 'ComputerName', SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
Param(
[Parameter( Mandatory = $true, Position = 0, ParameterSetName = 'ComputerName' )]
[string]$ComputerName
)
Process {
if ($PSCmdlet.ShouldProcess("Target", "Operation")) {
foreach ($Computer in $ComputerName) {
$ScheduledTasks = Get-ScheduledTask -CimSession $Computer -TaskName *
foreach ($ScheduledTask in $ScheduledTasks) {
$ScheduledTaskInfo = Get-ScheduledTaskInfo -CimSession $Computer -TaskName $ScheduledTask.TaskName
$ScheduledTaskInfo | Select-Object -Property TaskName, LastRunTime, LastTaskResult, NextRunTime, NumberOfMissedRuns, TaskPath, TaskState, PSComputerName
}
}
}
}
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.