Hi Glenn Maxwell,
These can be found in the Actions property of the task object.
$data = @()
foreach ( $task in (Get-ScheduledTask)) {
$taskinfo = Get-ScheduledTaskInfo $task
$data += [PSCustomObject]@{
Name = $task.taskname
Path = $task.TaskPath
Enabled = $task.Settings.Enabled
LastRun = $taskinfo.LastRunTime
NextRun = $taskinfo.NextRunTime
LastTaskResult = $taskinfo.LastTaskResult
Execute = $task.Actions.Execute
Arguments = $task.Actions.Arguments
WorkingDirectory= $task.Actions.WorkingDirectory
}
}
$data | Export-Csv c:\windows\temp\TS.csv -NoTypeInformation
Best Regards,
Ian Xue
If the Answer is helpful, please click "Accept Answer" and upvote it.