Khushboo
Khushboo

Reputation: 53

How to filter some particular tasks using get-scheduledTasks from task scheduler of a remote machine

I am trying to get list of scheduled tasks from some remote machines using the get-scheduledTasks cmdlet. How to list those tasks and filter out only few tasks out of them and perform actions based on the presence of those tasks

Upvotes: 0

Views: 742

Answers (1)

Ian Manning
Ian Manning

Reputation: 81

$name="Start of task name or absolute name"
$servers="server01","server02","server03"

$tasks = $servers | % { Invoke-Command -ComputerName $_ -ScriptBlock { Get-ScheduledTask | ? { $_.Name.StartsWith($name) } }

What you then do depends on what you want to do with those tasks.

Upvotes: 1

Related Questions