I am trying to print out information from the Task Scheduler
from the local computer in a PowerShell
script so other users can print out this information as well and not have to access the Task Scheduler
. I need the script to print out
- name,
- status,
- triggers,
- next run time,
- last run time,
- last run result,
- author,
- created.
I can print out the information about the name, next run time, and last run time, but the rest won't print out when I run the script.
I have already got a little start on my script and got the fields down.
$schedule = new-object -com("Schedule.Service")
$schedule.connect()
$tasks = $schedule.getfolder("\").gettasks(0)
$tasks | select Name,Status,Triggers,NextRunTime,LastRunTime,LastRunResult,Author,Created | ft
foreach ($t in $tasks)
{
foreach ($a in $t.Actions)
{
$a.Path
}
}
Any help or suggestions would be appreciated.
Below is a screenshot with what i am looking for and what fields arent printing out data: