0

I need to get all names of all schedules tasks which i do like this:

$tasks = Get-ScheduledTask | Get-ScheduledTaskInfo | Select TaskName,LastRunTime,LastTaskResult

Output looks something like this:

TaskName                                                LastRunTime                                                                                     LastTaskResult
--------                                                -----------                                                                                     --------------
GoogleUpdateTaskMachineCore                             31. 5. 2021 0:29:29                                                                                          0

Which is alright, but i wanna take only task names and print each one new line.

I tried this:

foreach($task in $tasks){
    Write-Host "$task.TaskName"
}

But output is this:

@{TaskName=Adobe Acrobat Update Task; LastRunTime=05/31/2021 11:14:14; LastTaskResult=0}.TaskName
@{TaskName=FSRM_Update; LastRunTime=05/31/2021 08:00:00; LastTaskResult=0}.TaskName

Can someone point me in right direction what am i doing wrong and why is output like this?

//EDIT Found answer here: Testing to see if a scheduled task exist in powershell

Johny Wave
  • 111
  • 2
  • 11

0 Answers0