I have an existing scheduled task that I would like to add multiple triggers to.
I do this:
$trigger = New-ScheduledTaskTrigger -At 1PM -Once Set-ScheduledTask -TaskName "Task Name" -Trigger $trigger
It will overwrite the trigger that is already in there.
However, I want to create multiple triggers.
I try this:
$trigger = New-JobTrigger -Once -At 1PM Add-JobTrigger -Trigger $trigger -Name "Task Name"
$trigger = New-ScheduledTaskTrigger -Once -At 1PM Add-JobTrigger -Trigger $trigger -Name "Task Name"
In both cases, I get the error "A scheduled job definition with Name Task Name could not be found" (There is a task there called "Task Name")
What do I need to do to simply add multiple triggers to a single task?