12 October, 2023
PowerShell – modifying Task Scheduler trigger
Here’s a small code snippet I wrote for modifying triggers of a specific task – I needed to add a delay for all of them.
$task = Get-ScheduledTask -TaskName "Start TeamCity"
foreach($trigger in $task.Triggers) {
$trigger.Delay = "PT5M"
}
Set-ScheduledTask -InputObject $task
That’s it!